{"id":49519507,"url":"https://github.com/supaku/kith","last_synced_at":"2026-05-01T23:01:27.939Z","repository":{"id":355051057,"uuid":"1225018611","full_name":"supaku/kith","owner":"supaku","description":"macOS CLI bridging Apple Contacts and iMessage for terminal users + AI agents.","archived":false,"fork":false,"pushed_at":"2026-05-01T17:14:36.000Z","size":97,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-01T17:18:58.897Z","etag":null,"topics":["ai-agents","cli","contacts","imessage","llm-tools","macos","swift","terminal"],"latest_commit_sha":null,"homepage":"https://github.com/supaku","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/supaku.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-04-29T21:35:27.000Z","updated_at":"2026-05-01T17:14:40.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/supaku/kith","commit_stats":null,"previous_names":["markkropf/kith"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/supaku/kith","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/supaku%2Fkith","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/supaku%2Fkith/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/supaku%2Fkith/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/supaku%2Fkith/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/supaku","download_url":"https://codeload.github.com/supaku/kith/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/supaku%2Fkith/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32515838,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-30T13:12:12.517Z","status":"online","status_checked_at":"2026-05-01T02:00:05.856Z","response_time":64,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai-agents","cli","contacts","imessage","llm-tools","macos","swift","terminal"],"created_at":"2026-05-01T23:01:25.473Z","updated_at":"2026-05-01T23:01:27.929Z","avatar_url":"https://github.com/supaku.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# kith\n\n[![CI](https://github.com/supaku/kith/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/supaku/kith/actions/workflows/ci.yml)\n[![Release](https://img.shields.io/github/v/release/supaku/kith?label=release\u0026sort=semver)](https://github.com/supaku/kith/releases)\n[![License: MIT](https://img.shields.io/github/license/supaku/kith)](./LICENSE)\n[![macOS 14+](https://img.shields.io/badge/macOS-14%2B-blue)](https://github.com/supaku/kith#permissions)\n\n\u003e A macOS CLI that bridges Apple Contacts and iMessage for terminal users and AI agents.\n\n`kith` resolves a name to a person to a chat. The killer flow:\n\n```sh\nkith history --with \"Mark Kropf\"\n```\n\n…walks `CNContactStore` to find Mark, collects all his phones (E.164) and emails,\njoins them against `~/Library/Messages/chat.db` to find the canonical 1:1\nconversation, and streams messages newest-first. Group chats and named threads\nare auto-excluded so \"messages with Mark\" actually means messages with Mark.\n\nRead-only. macOS 14+. arm64.\n\n---\n\n## Install\n\n### Homebrew (recommended)\n\n```sh\nbrew tap supaku/tools\nbrew install --cask kith\n```\n\nPulls the signed + notarized arm64 binary from the latest [GitHub Release](https://github.com/supaku/kith/releases). The cask is auto-bumped on every tag push — see [RELEASING.md](./RELEASING.md) for how that works.\n\n### Build from source\n\nIf you'd rather compile locally — useful on machines without an `arm64` Homebrew, or for development — `Formula/kith.rb` ships a build-from-source formula:\n\n```sh\nbrew tap supaku/kith https://github.com/supaku/kith\nbrew install kith\n```\n\n### Manual\n\n```sh\ngit clone https://github.com/supaku/kith.git\ncd kith\nswift build -c release\ncp .build/release/kith ~/bin/   # or anywhere on $PATH\n```\n\nOr use the bundled script — it stamps `BuildInfo.swift` with the current commit\nSHA + ISO build timestamp:\n\n```sh\nscripts/build.sh\n```\n\nTo codesign with a Developer ID Application certificate (hardened runtime):\n\n```sh\nKITH_SIGN_IDENTITY=\"Developer ID Application: Your Name (TEAMID)\" scripts/build.sh\n```\n\n---\n\n## Permissions\n\n`kith` needs two macOS permission grants. Run `kith doctor` first — it tells\nyou exactly what's missing and how to fix it.\n\n### 1. Contacts\n\nGranted via the standard TCC prompt the first time you run `kith find`. If your\nterminal isn't pre-listed in **System Settings → Privacy \u0026 Security → Contacts**:\n\n- Click `+`, navigate to your terminal app (Ghostty, iTerm, Terminal, etc.), add it.\n- For Electron apps (VS Code), you must `+`-add manually since they don't declare\n  `NSContactsUsageDescription`.\n- **Cmd+Q to fully quit your terminal**, then relaunch — TCC grants only inherit\n  on a fresh process tree.\n\n### 2. Full Disk Access\n\nRequired to read `~/Library/Messages/chat.db`. There is no programmatic prompt:\n\n- **System Settings → Privacy \u0026 Security → Full Disk Access**.\n- Add your *terminal* (not the `kith` binary itself — FDA is inherited by child\n  processes).\n- Restart the terminal.\n\nIf `kith doctor --json` reports `permissions.fullDiskAccess.status: \"denied\"`,\nthe most common fix is the quit-and-relaunch step — toggling the switch while\nthe terminal is running won't take effect.\n\n---\n\n## Usage\n\n### Find people\n\n```sh\nkith find --name \"Mark\"\nkith find --email \"@acme.com\"\nkith find --phone \"(415) 555-1212\"\nkith find --org \"Rensei\" --jsonl\n```\n\n### Resolve canonically\n\n```sh\nkith get \"Mark Kropf\"\nkith get 0AB81E1A-DEAD-BEEF-CAFE-000000000001 --json\n```\n\n### List chats\n\n```sh\nkith chats --limit 20\nkith chats --with \"Mark Kropf\"          # cross-domain: name → all chats\nkith chats --participant \"+14155551212\"  # by handle\n```\n\n### Stream message history\n\n```sh\nkith history --with \"Mark Kropf\"                     # canonical 1:1 (default)\nkith history --with chat-id:158                       # explicit chat\nkith history --with \"Mark Kropf\" --limit 200 --jsonl\nkith history --with \"Mark Kropf\" --start 2026-01-01T00:00:00Z\nkith history --with \"Mark Kropf\" --inline            # render images in supported terminals\nkith history --with \"Mark Kropf\" --raw-text          # skip the U+FFFC/U+FFFD/U+0000 cleanup\nkith history --with \"Mark Kropf\" --include-reactions\nkith history --with \"Mark Kropf\" --attachments       # add metadata array per message\n```\n\n`--with` accepts: `name | phone | email | chat-id:\u003cn\u003e | chat-guid:\u003cg\u003e | \u003cCNContact-uuid\u003e`.\nChat-id and chat-guid forms **require** the prefix; bare integers are never\ninterpreted as chat IDs. Multiple chat-ids can be unioned via\n`--with chat-id:1,4,7`.\n\nThe default behavior auto-prefers the canonical 1:1 conversation (chat where\n`chat_identifier` matches an identity, no `display_name`, exactly one other\nparticipant) — group chats and named threads are excluded. When the resolution\nspans multiple 1:1 shards (chat-id rotation), they're unioned silently. When\nonly group chats match, kith exits 4 with the candidate list so you can pick\nexplicitly.\n\n### Diagnostics\n\n```sh\nkith doctor               # human report\nkith doctor --json        # machine-readable\n```\n\n### Agent introspection\n\n```sh\nkith tools manifest --style kith        # native shape (source of truth)\nkith tools manifest --style anthropic   # input_schema-style tools array\nkith tools manifest --style openai      # function-tool array\nkith tools manifest --style json-schema # full JSON Schema 2020-12\n\nkith tools schema --type Message        # any of: Contact, ContactGroup, Chat,\n                                        # Message, Handle, Attachment, Error,\n                                        # DoctorReport\nkith tools help                         # full command surface in one stream\n```\n\n---\n\n## Output\n\n### Modes\n\n| flag | applies to | format |\n|------|-----------|--------|\n| (none) | all commands | TTY-friendly human output, ANSI-styled |\n| `--json` | single-record commands (`get`, `doctor`, `version`) | one JSON object |\n| `--jsonl` | streaming commands (`find`, `chats`, `history`, `groups …`) | newline-delimited objects |\n\nErrors emit a JSON envelope to stderr in machine mode (`code`, `exit`,\n`message`, `hint`, `candidates`); in human mode, a single-line error + indented\nhint + a candidate list when relevant.\n\nColor is automatic when stdout is a TTY. Override via `--color {auto,always,never}`,\n`KITH_COLOR=always|never`, `NO_COLOR`, or `CLICOLOR_FORCE=1` env vars.\n\n### Inline images\n\n`kith history --inline` renders attachment images directly in the terminal\nwhen one of these is detected:\n\n- **iTerm2** (`TERM_PROGRAM=iTerm.app`) — iTerm2 inline image protocol.\n- **VS Code's integrated terminal** (`TERM_PROGRAM=vscode`) — same protocol.\n- **WezTerm** (`TERM_PROGRAM=WezTerm`) — same protocol.\n- **Ghostty** (any of `GHOSTTY_RESOURCES_DIR`, `GHOSTTY_BIN_DIR`,\n  `GHOSTTY_VERSION`, `TERM_PROGRAM=ghostty`) — Kitty graphics protocol.\n- **Kitty / KITTY_WINDOW_ID set** — Kitty graphics protocol.\n\nIf none match, `--inline` silently falls back to `[attachment: \u003cname\u003e]` text.\nForce the protocol with `KITH_INLINE_PROTOCOL=kitty|iterm2|none` (helpful inside\ntmux, where outer-terminal env vars sometimes get masked). Set `KITH_DEBUG=1`\nto see why a particular attachment didn't render.\n\nHEIC / HEIF / WEBP attachments are converted to PNG via `/usr/bin/sips` before\ntransmission. Animated GIFs render as a still on Kitty-protocol terminals.\n\n`--inline` is mutually exclusive with `--jsonl`.\n\n### Exit codes\n\n| code | meaning |\n|------|---------|\n| 0 | OK |\n| 1 | GENERIC_ERROR |\n| 2 | USAGE |\n| 3 | NOT_FOUND |\n| 4 | AMBIGUOUS_MATCH (caller must disambiguate) |\n| 5 | PERMISSION_DENIED (TCC: Contacts or FDA) |\n| 6 | DB_UNAVAILABLE |\n| 7 | INVALID_INPUT |\n\n---\n\n## Agent integration\n\n`kith` is built so an LLM agent can ingest the entire CLI surface with one\ntool call:\n\n```sh\n# Native shape — ideal for an in-house tool registry.\nkith tools manifest --style kith\n\n# Drop straight into an Anthropic Messages API tools[] array.\nkith tools manifest --style anthropic\n\n# OpenAI tool-calling shape.\nkith tools manifest --style openai\n\n# Or, if your agent prefers reading help text rather than JSON schemas:\nkith tools help                  # 200-ish lines, every command + flag\n```\n\nFor BI/observability use cases, the typical recipe is:\n\n1. `kith doctor --json` once, gate on `ok: true`.\n2. `kith find --name \"\u003cquery\u003e\" --jsonl --limit 5` to surface candidate contacts.\n3. `kith get \"\u003cexact-full-name\u003e\" --resolve-only --json` to lock in `id` +\n   `fullName` (the CNContact UUID is stable; a future-proof handle).\n4. `kith history --with \u003cid\u003e --jsonl --limit 200` to stream messages.\n\nPin the contact UUID in your records — it survives renames and contact merges\nbetter than a phone number.\n\n---\n\n## Layout\n\n| path | what |\n|------|------|\n| `Sources/kith` | the executable + manifest projections |\n| `Sources/ContactsCore` | `CNContactStore` wrapper + `Contact`/`ContactGroup` models |\n| `Sources/MessagesCore` | vendored from [imsg](https://github.com/steipete/imsg) (MIT) — sync via `scripts/vendor-sync.sh` |\n| `Sources/ResolveCore` | the `--with` parser + cross-domain `Resolver` |\n| `Tests/*Tests` | Swift Testing test suites |\n| `Formula/kith.rb` | Homebrew formula (build-from-source) |\n| `.github/workflows/` | CI + release |\n| `.claude/PLAN.md` | v1 architecture plan (single source of truth) |\n\n`THIRD_PARTY_NOTICES.md` carries the MIT attribution + full license text for\nvendored sources.\n\n---\n\n## Tests\n\n```sh\nswift test\n```\n\n79+ Swift Testing tests across 4 targets. The non-CN-dependent suites use\nin-memory SQLite fixtures; `kithTests` shells the built binary against an\non-disk fixture DB via `KITH_DB_PATH`. None of the tests require real Contacts\nor FDA grants.\n\n---\n\n## License\n\nMIT — see `LICENSE`. Vendored MessagesCore is also MIT (Peter Steinberger);\nsee `THIRD_PARTY_NOTICES.md` for attribution.\n\nA [Supaku Labs](https://github.com/supaku) project.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsupaku%2Fkith","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsupaku%2Fkith","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsupaku%2Fkith/lists"}