Codync
CLAUDE.md170 starsChanged 59 days agoMITView on GitHub
Bot-based remote for coding agents: persistent named bots on your computer, messaged from the iPhone (UI patterns from Grok Bot).
In this repository17 other files it gives its agents.
- AGENTS.mdAGENTS.md
- web/AGENTS.mdAGENTS.md
- web/CLAUDE.mdCLAUDE.md
- animate-expoSkill
- animateSkill
- animation-vocabularySkill
- apple-designSkill
- ask-sonnerSkill
- emil-design-engSkill
- find-animation-opportunitiesSkill
- improve-animationsSkill
- mobile-nativeSkill
- pick-ui-librarySkill
- product-launch-filmSkill
- prototypeSkill
- review-animationsSkill
- write-swiftSkill
The file
We split this CLAUDE.md into the rules it gives an agent
9 rules. About 0 are common, 3 are distinctive, and 6 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
6
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 8
Prefer SwiftUI lifecycle and modern APIs (MenuBarExtra, @Observable, @State, @Environment)
- Very specific: line 9
Use structured concurrency (async/await, TaskGroup) over Combine
- Very specific: line 10
Use sending, nonisolated, @MainActor correctly per Swift 6 rules
- Very specific: line 11
Avoid @unchecked Sendable — prefer proper Sendable conformance
- Very specific: line 27
Sync: every mutation stamps a global rev.
- Distinctive: line 41
Keep shared features, actions, terminology, displayed information, and loading, empty, error, and permission states consistent.
- Distinctive: line 50
Don't carry legacy along. Old names, settings, schemes, files or code paths left from earlier designs get renamed or deleted outright when …
- Distinctive: line 54
Always stop the old Mac app, host and iPhone process before running a new build (old host = old protocol, old app = old UI).
- Very specific: line 101
Keep docs/ current: update the doc in the same change that makes it stale.
≈ “Common” is an estimate: at least 1 in 5 of the 12,729 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Codync
Bot-based remote for coding agents: persistent named bots on your computer, messaged from the iPhone (UI patterns from Grok Bot).
Language & Syntax
- Swift 6 strict concurrency mode — use latest Swift 6 syntax throughout
- Prefer SwiftUI lifecycle and modern APIs (
MenuBarExtra,@Observable,@State,@Environment) - Use structured concurrency (
async/await,TaskGroup) over Combine - Use
sending,nonisolated,@MainActorcorrectly per Swift 6 rules - Avoid
@unchecked Sendable— prefer properSendableconformance - Host is Rust 2024 edition and follows the
rust-skillsrules (~/.agents/skills/rust-skills). Lints live inhost/Cargo.toml([lints]: default groups + pedantic,unwrap_used); CI runscargo fmt --checkandcargo clippy --all-targets -- -D warnings - Host conventions: no
unwrap()outside tests (expect("why this can't fail")for true invariants); lock std mutexes withLockExt::locked()(poison-tolerant); enums, not strings, for states and modes (BotStatus,Permission,EntryKind,AlertKind);tracingwith structured fields (error = format!("{e:#}")keeps the context chain); blocking fs/process work goes throughspawn_blocking; registry JSON is untrusted (paths are validated)
Architecture
- Clients: iOS app, native Mac window (menu bar app), native Linux app (
apps/linux/, GTK 4 + libadwaita in Rust), terminal UI (codync-host tui,host/src/tui/, ratatui; layout and state vocabulary modeled on herdr). All talk to the host API; no web UI. - Shared Swift (
kit/):CodyncKit(models, client, theme, avatars) +CodyncUI(BotStore+ chat screens) used by iOS and macOS. Platform specifics go throughBotStorehooks orPlatform.swift. - UI principle: buttons an icon can express are icon-only (with tooltip / accessibility label); text only where an icon would be ambiguous (approval choices).
- UI controls default to the shared custom components. Explicit exception: iOS BotListView and ThreadView use native navigation/toolbar items and automatic back navigation for system Liquid Glass, as specified in
docs/design/ui-conventions.md. iOS menus are always the system ones: tap menus throughDropdownMenu/ChoicePicker(nativeMenu), long-press through.contextActions(nativecontextMenu). Never hand-build a dropdown on iOS and never call.codyncMenuthere (it is macOS-only and a compile error on iOS): the custom overlay lands in the wrong place (sheets, scroll views, the composer's + menu). The macOS menu bar also uses nativeMenuBarExtra(.menu), menus, pickers and toggles. Keep system authentication and widget containers native. On iOS.codyncSheetpresents the system sheet (grabber, swipe down). Outside these exceptions, avoid: noMenu/Picker,.switchtoggles,Form/Liststyling,confirmationDialog/alert,ProgressView,.sheet/.popover/.fullScreenCover,.toolbar/navigation bars,TabView,ContentUnavailableView. Usekit/Sources/CodyncUI/Controls.swift+Chrome.swift(.codyncSheet,ModalHeader,ScreenHeader,TabBar,.codyncMenu,.codyncDialog,ToggleStyle.codync). Every tap that shows/hides something animates (Motion). Anything with a background fill gets no border line. host/— codync-host (Rust, macOS + Linux). Detects installed harnesses (agent/backends.rs: login-shell PATH + known dirs) and the ACP registry (agent/registry.rs, cached in~/.codync/registry.json, binaries under~/.codync/agents). Drives agents over ACP (JSON-RPC on stdio, hand-rolled inagent/acp.rs, updates kept asserde_json::Valueso new adapter variants never break parsing). One actor per bot (agent/bot.rs) owns the agent process + session and mapssession/updateonto transcript entries.- Chat ≠ session: a bot is one endless transcript (SQLite
entries, ordered byseq); the ACP session underneath is resumed withsession/loador replaced by New session. - Group chats and threads are host features every client drives through the same methods (
sendwiththreadId,thread,createBot {kind: group}); clients never route, parse mentions or count replies themselves. A group is a roster row whose members answer in their own sessions (Grok Bot's room turns); a thread on a bot's message is a forked session: docs/features/groups-and-threads.md. - Bot collaboration: built-in
teamMCP (chat/team.rs) lists visible bots and asks one for a reply through its actor queue. Requests are separate turns, cycle-checked and cancellable; native subagents stay with the harness. See docs/features/bot-collaboration.md. - Context & memory (Grok Bot's design): frozen instruction snapshot per session + compaction epoch (Claude gets it as a system prompt), profile edits as update blocks, per-bot memory files written by a keeper agent, busy-time messages folded into one turn, interrupted turns resumed: docs/features/context-and-memory.md.
- Chat shows only: user messages, the final agent message of each turn (
data.final), permission cards, notices. Narration, thoughts, tool calls, plans are trace entries (Full conversation sheet). - Sync: every mutation stamps a global
rev. Clients callGET /events?since=<rev>(catch-up in rev order, then live). Emission happens underHub::emit_lockso events leave in rev order. Clients upsert by id; never skip undecodable events (the iOS app rewinds to rev 0). - API:
POST /api/<method>+ SSE with the bearer token (~/.codync/token) is loopback only (Mac app, SSH tunnel, local helpers). Phones and other remote clients use the E2E channel (/channeldirect, or the Cloudflare relay). Default port 19222. - Remote access (Cloudflare relay primary, direct LAN/Tailscale alternative, accounts, SSH, public routine webhooks queued in the relay §7.8): docs/reference/remote-relay.md.
- Remote screen (
host/src/screen.rsis the reference): phones view/control the computer over WebRTC (hardware H.264, non-trickle SDP relayed byscreenOffer, input on data channelsinput/input-fast); bots get the built-incomputerMCP server (codync-host mcp computer,host/src/mcp.rs) when theircomputerflag is on. Capture/input live in a helper on~/.codync/screen.sock:apps/screen-macos(macOS, launchd agent viaSMAppService, owns the TCC grants) orapps/screen-linux(codync-screen: portals + GStreamer, started by the host). Off by default;setScreenEnabledis accepted only from loopback. An interactive phone takes over (bots may only look). - Multiple computers per account are future work, not a current priority: the product targets one computer. The multi-computer structure (
AccountStore,BotReference) stays because relay/accounts/SSH build on it; don't extend or polish multi-computer features unless asked. - Environments: dev (
dev-api.codync.dev, Clerk development instance, Debug builds) and main (api.codync.dev, Clerk production, Release builds);apps/shared/Config/<env>.plistbecomesAccountConfig.plist. Details: spec §14.0. - Push: iOS registers its APNs token with
relay/→ gets an AES-GCM ticket → gives it (plus its X25519 push key) to the host; the host seals title/body to that key and a Notification Service Extension opens it, sorelay/sees only generic text. Alert kinds: needs you, done, and failed, suppressed while the iOS app is connected. Delivery and lifecycle: notification design. - Voice call (iPhone, Mac): on-device speech, or OpenAI / Gemini realtime on the user's own key (kept in the host's vault, which mints per-call credentials; audio goes device ↔ provider); the host sees plain messages. Grok-style call bar: docs/features/voice-call.md.
- Usage: local only —
claude -p /usage --no-session-persistence, the Claude status line (codync-host statusline, wrapping any existing one), Claude ACPusage_updaterate-limit meta, Codex rollout files. Never call provider APIs with agent credentials. - macOS app is thin: embeds
codync-hostinContents/MacOS(Xcode post-build script runs cargo), installs it as a launchd agent viacodync-host install; menu bar shows status/pairing/usage and opens the native chat window (NavigationSplitView overCodyncUI). Not sandboxed, not Mac App Store (the host must spawn CLIs).
Cross-platform UI changes
- Any UI change in any client must include the corresponding updates to all other native clients and the TUI in the same change: shared SwiftUI (
kit/Sources/CodyncUI/), iOS (apps/ios/), macOS (apps/macos/), Linux GTK (apps/linux/src/), and terminal UI (host/src/tui/). This applies in every direction; Linux and TUI changes must also be reflected in SwiftUI. - Keep shared features, actions, terminology, displayed information, and loading, empty, error, and permission states consistent. Adapt layout, controls, and input to each platform, including terminal keyboard interaction, while preserving the same user-facing behavior.
- Inspect every client's corresponding implementation before finishing a UI task. Implement applicable changes together; do not silently defer another client. For a platform-only change or an unsupported capability, document which clients are unaffected and the concrete reason in the change summary.
- Validate each affected client with its relevant build/tests and UI checks. Report any checks that could not run and why.
- Shared SwiftUI (
kit/) builds into both iPhone and Mac: never change a shared view's or control's defaults for one platform, and keep one-platform chrome in platform files (ui-conventions).
Codync 1.x does not exist for us
- Ignore everything from Codync 1.x (the Claude Code hooks + CloudKit session monitor): no migration, no compatibility shims, no cleanup of its files or hooks, no keeping old workers or App Store copy alive for it. Don't mention 1.x in code, docs or release notes.
- Build only the current design; don't reintroduce hooks or CloudKit.
- Don't carry legacy along. Old names, settings, schemes, files or code paths left from earlier designs get renamed or deleted outright when you meet them, not kept "for compatibility". Put full effort into the new design.
Installing a new build: kill the old one first
Always stop the old Mac app, host and iPhone process before running a new build (old host = old protocol, old app = old UI); commands in docs/guides/development.md.
Keep only the latest build: in this checkout, Apple builds go to build/dd only (no other -derivedDataPath, no copies in scratchpads, /tmp or Xcode's DerivedData); delete any older Codync build right away, so macOS never launches a stale copy. A git worktree may keep its own single build inside that worktree.
Project generation
apps/project.yml+xcodegen generate --spec apps/project.ymlproduceapps/Codync.xcodeproj. Editproject.yml, not the pbxproj.
App Store Upload
- Xcode Cloud archives the
iOSscheme on everyv*tag and uploads it to App Store Connect with its own build number, then theSubmit iOSworkflow submits it to App Review for the App Store; don't upload from the local machine or editCURRENT_PROJECT_VERSIONfor it. Details: development guide.
Versioning
- Phone ↔ host compatibility: each side names the oldest version of the other it works with (
minAppin the host'shello,minHostin each client). Additive changes need nothing; a rename/removal raisesminAppin the same release, and hosts hold that release until the App Store has the iPhone app: docs/reference/compatibility.md - Every source change ships as a release. A version bump on
mainis the only release trigger (Auto Tag → DMG, host, Linux app, Homebrew, in-app update), so any change to shipped code (apps/,kit/,host/,packaging/) bumps the version before it reachesmain, without being asked. Docs,web/,cloud/,relay/and CI-only changes don't bump. - Pick the bump yourself: patch for fixes and small tweaks, minor for new features or protocol additions. Never bump major (stay on 2.x). One bump per merge into
main: ifMARKETING_VERSIONis already ahead of the latestv*tag, leave it. - How: set
MARKETING_VERSIONinapps/project.ymlandversioninhost/Cargo.tomlandapps/linux/Cargo.toml(+ theirCargo.lockentries) to the same value, runxcodegen generate --spec apps/project.yml, commit asbuild: bump version to X.Y.Z. Never touchCURRENT_PROJECT_VERSION(Xcode Cloud sets the iOS build number). When the iOS app changes, also write that version's section inapps/ios/WhatsNew.md(zh-Hant + en-US, what iPhone users notice); it becomes the App Store "What's New".
Targets
macOS(apps/macos/) — menu bar app + embedded hostiOS(apps/ios/) — iOS appScreen(apps/screen-macos/) — Codync Screen: capture, input and WebRTC for Remote screen, embedded in the Mac app (Contents/Library/LoginItems)apps/screen-linux/—codync-screen(Rust, GStreamer + xdg portals), the Linux Remote screen helper; build/test in the same container asapps/linuxWidgets(apps/ios/Widgets/) — usage widget + bot Live Activity (bundle idcom.pokai.Codync.ios.LiveActivity)CodyncKit(kit/) — shared Swift package:CodyncKit+CodyncUIlibrariesapps/linux/—codyncGTK app (build/test in a container with libgtk-4-dev + libadwaita-1-dev + libvte-2.91-gtk4-dev)
Layout & naming
Folder layout, file naming and shared terms: docs/architecture/file-structure.md. Follow it when adding or moving files.
Commit messages
- Conventional Commits:
type(scope): subject. Types:feat,fix,refactor,perf,docs,test,build,ci,chore. Scope is the area touched:ios,macos,kit,host,linux,cloud,relay,web,docs. - Subject: imperative mood ("add", not "added"), lowercase after the colon, no trailing period, at most 72 characters (aim for 50). Say what changes for the user, not which files moved.
- Body (after a blank line, wrapped at 72 columns) when the change isn't obvious from the subject: what and why, not how. Bullets are fine.
- One logical change per commit. Don't mix unrelated work, and stage only your own hunks when others have uncommitted changes in the tree.
- Breaking changes:
!after the type/scope, or aBREAKING CHANGE:footer. - English only.
- PRs: fill the template's What's New bullets (zh-Hant + en-US) for user-visible iOS changes; they become the App Store notes when
apps/ios/WhatsNew.mdhas no section for the release.
Keeping this file short
- CLAUDE.md and AGENTS.md hold only rules an agent needs on every task. Reference material (file structure, naming tables, API details, audits, how-tos) goes in
docs/as its own file, with a one-line pointer here. - Whenever you edit either file, check its length: past ~100 lines, or a section past a few lines of reference detail, refactor that detail into
docs/and leave the pointer, without being asked. - Keep
docs/current: update the doc in the same change that makes it stale.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

