agentleFS
o1xhacko1xhack/CodexBar-Mobile/AGENTS.md

CodexBar-Mobile

AGENTS.md71 starsChanged 57 days agoMITView on GitHub

This file is the repo-level routing and quality gate for AI agents working on CodexBar Mobile (iOS). Detailed operational workflows live in skills. Scope: We only work on the iOS app (CodexBarMobile/). Mac-side code is maintained upstream. Current upstream alignment: see version.env at repo root — UPSTREAM_VERSION and UPSTREAM_SYNC_DATE are the authoritative fields. Do NOT consult plan.md for this — it's a human-curated planning doc and lags reality. - Use $codexbar-git-workflow for branch creation, commit cadence, Git/GitHub push, PR, review…

  • Reads credentials
  • Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about checking a change actually works.

    Of the AGENTS.md files we read, the 11,773 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.

  • In this repository6 other files it gives its agents.

The file

Show its rules and text

We split this AGENTS.md into the rules it gives an agent

45 rules. About 0 are common, 19 are distinctive, and 26 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈19

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 26

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Use $codexbar-git-workflow for branch creation, commit cadence, Git/GitHub push, PR, review loop, branch cleanup, and Todoist handoff.

    line 12
  2. Very specific:

    Use $release-codexbar for Mac signing/notarization/appcast/GitHub release work.

    line 14
  3. Very specific:

    Use $qa-test for live provider QA, menu proof, and release smoke tests.

    line 16
  4. Distinctive:

    Every feature or fix follows these 7 steps in order:

    line 22
  5. Very specific:

    Use Git/GitHub for branch and commit operations.

    line 56
  6. Distinctive:

    Before writing any code, understand the problem space.

    line 97
  7. Distinctive:

    Read relevant source code, SDK docs, and real synced data

    line 99
  8. Distinctive:

    Check upstream (steipete/CodexBar) for existing implementations or open PRs

    line 100
  9. Distinctive:

    Write or update the research doc with chosen approach, data models, key files

    line 105
  10. Distinctive:

    Follow protocol-first design: define interfaces before writing logic

    line 122
  11. Distinctive:

    Follow all coding rules below (localization, file conventions, etc.)

    line 124
  12. Distinctive:

    Run unit tests if applicable

    line 129
  13. Distinctive:

    Verify on simulator or real device as needed

    line 130
  14. Distinctive:

    Add or extend XCTest / Swift Testing coverage for provider, parser, model, and settings changes.

    line 131
  15. Very specific:

    Run focused swift test --filter ...

    line 134
  16. Very specific:

    Never run tests/checks or ad-hoc validation that can display macOS Keychain prompts.

    line 136
  17. Very specific:

    Every PR update runs only PR Fast Checks (portable lint and policy guards).

    line 148
  18. Very specific:

    Never resolve an upstream workflow conflict by restoring heavy CI on PR synchronize events.

    line 155
  19. Distinctive:

    After code is complete:

    line 164
  20. Very specific:

    Update CodexBarMobile/CHANGELOG.md — Keep a Changelog format (Added / Changed / Fixed)

    line 166
  21. Very specific:

    Update in-app release notes in MobileReleaseNotesCatalog (in ContentView.swift) — plain language, 4-language localized

    line 167
  22. Distinctive:

    Check if an existing line already covers this feature area.

    line 169
  23. Distinctive:

    If yes → merge the new detail into that line (rewrite it to include the update).

    line 170
  24. Distinctive:

    If no existing line covers it → add a new line.

    line 171
  25. Very specific:

    Only create a separate ReleaseNotesVersion entry when MARKETING_VERSION itself changes (e.g.

    line 172
  26. Very specific:

    Update research doc status to done

    line 173
  27. Very specific:

    When work needs a branch, commit, push, PR, review loop, branch cleanup, or Todoist status update, load and follow $codexbar-git-workflow.

    line 184
  28. Very specific:

    Before merging any PR, wait for Codex Code Review on the exact current head, fix and retest every finding, reply and explicitly resolve …

    line 187
  29. Very specific:

    Run Scripts/check_pr_review_gate.sh <pr> immediately before merge.

    line 190
  30. Distinctive:

    All builds (Mac and iOS) must use CloudKit Production environment:

    line 228
  31. Distinctive:

    If this entitlement is missing, Mac defaults to Development environment and TestFlight iOS uses Production — data goes to different …

    line 234
  32. Very specific:

    Before every Mac release: run the audit in docs/cloudkit-deploy-audit.md to decide whether the Production schema needs a Dashboard deploy.

    line 238
  33. Distinctive:

    When the user asks to upload / archive / release:

    line 242
  34. Very specific:

    Update CHANGELOG.md — Mobile changes first, upstream second

    line 265
  35. Very specific:

    Create GitHub release on o1xhack/CodexBar-Mobile (not upstream)

    line 268
  36. Very specific:

    Use Git/GitHub for branch, commit, push, PR, review, and branch cleanup work.

    line 279
  37. Very specific:

    Do not use jj unless the user explicitly re-enables it.

    line 280
  38. Very specific:

    Do not modify Mac-only files such as Sources/ or Tests/ unless the user explicitly asks for Mac/upstream-sync/release work.

    line 285
  39. Very specific:

    Never push to upstream; only push to origin.

    line 287
  40. Distinctive:

    After the merge, separately audit the upstream README diff for factual product, security, or troubleshooting changes and deliberately adapt …

    line 291
  41. Very specific:

    Do not hand-edit .xcodeproj.

    line 297
  42. Distinctive:

    Do not skip build numbers, changelog, release notes, CloudKit audit, or localization checks when their step applies.

    line 299
  43. Very specific:

    Do not add full build/test matrices to PR update events.

    line 301
  44. Very specific:

    All strings use String(localized:) — the key is the English text itself

    line 311
  45. Very specific:

    Every entry must have all 4 translations with "state": "translated"

    line 313

≈ “Common” is an estimate: at least 1 in 5 of the 16,595 AGENTS.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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
AGENTS.md

CodexBar Mobile — Agent Workflow

This file is the repo-level routing and quality gate for AI agents working on CodexBar Mobile (iOS). Detailed operational workflows live in skills.

Scope: We only work on the iOS app (CodexBarMobile/). Mac-side code is maintained upstream.

Current upstream alignment: see version.env at repo root — UPSTREAM_VERSION and UPSTREAM_SYNC_DATE are the authoritative fields. Do NOT consult plan.md for this — it's a human-curated planning doc and lags reality.

Required Skills

  • Use $codexbar-git-workflow for branch creation, commit cadence, Git/GitHub push, PR, review loop, branch cleanup, and Todoist handoff.
  • Use $release-codexbar for Mac signing/notarization/appcast/GitHub release work.
  • Use $qa-test for live provider QA, menu proof, and release smoke tests.

Development Lifecycle

Every feature or fix follows these 7 steps in order:

┌───────────────────┬─────────────────────────────────────────────────┬─────────────────────┐
│       Step        │                   Description                   │       Output        │
├───────────────────┼─────────────────────────────────────────────────┼─────────────────────┤
│ 1. Research       │ Understand the problem, read code/SDK/data      │ Root cause or       │
│                   │ Check upstream repo + PRs for prior art         │ requirements doc    │
├───────────────────┼─────────────────────────────────────────────────┼─────────────────────┤
│ 2. Design         │ Write research doc in Research/, mark draft     │ Research/NNN-*.md   │
│                   │ Get user confirmation on approach               │                     │
├───────────────────┼─────────────────────────────────────────────────┼─────────────────────┤
│ 3. Implementation │ Write code in phases, protocol-first            │ Code changes        │
├───────────────────┼─────────────────────────────────────────────────┼─────────────────────┤
│ 4. Testing        │ Build, simulator, real device if needed         │ Tests pass          │
├───────────────────┼─────────────────────────────────────────────────┼─────────────────────┤
│ 5. Documentation  │ Update CHANGELOG, in-app release notes,         │ Traceable record    │
│                   │ research doc status → done                      │                     │
├───────────────────┼─────────────────────────────────────────────────┼─────────────────────┤
│ 6. Commit         │ Branch/commit/GitHub handoff via skill         │ git commit / PR     │
├───────────────────┼─────────────────────────────────────────────────┼─────────────────────┤
│ 7. Push & Release │ Push to remote, archive, upload to TestFlight   │ User-installable    │
└───────────────────┴─────────────────────────────────────────────────┴─────────────────────┘

Repository map

Remote / branchRole
upstream / steipete/CodexBarOriginal open-source repo, read only
origin / o1xhack/CodexBar-MobileOur fork
mobile-devMain working branch
mainUpstream-alignment branch; do not modify directly

Use Git/GitHub for branch and commit operations. Create a task branch before implementation unless the request is read-only. Do not require Goal prompts to spell out branch names; choose the right branch shape from $codexbar-git-workflow.

Definition of Done for release / upstream-sync work

For release and upstream-sync tasks, done means user-installable artifacts exist, not just "code committed" or "pushed":

  • Mac: signed + notarized Sparkle draft/release flow completed as requested
  • iOS: archive/export/upload flow completed when upload/TestFlight is in scope
  • appcast, versioning, CloudKit audit, release notes, and Todoist state are updated

Credentials live on the user's Mac. CodexBar-specific release secrets such as Sparkle live under ~/.codexbar-secrets/; Apple App Store Connect App Manager credentials are global Apple release/signing credentials under ~/.codex-secrets/apple/app-store-connect/; the Developer ID certificate is in Keychain. When the user has authorized release/upload work, run the release commands on this machine instead of only listing commands for the user. The complete release gate is docs/RELEASE-CHECKLIST.md; read it before every release or upstream-sync completion check.

Collaboration roles

User intentAgent roleAction
调研 / researchArchitectRun Steps 1-2 and write/update Research/
开发 / implementDeveloperRun Steps 3-4 with focused implementation + tests
开分支 / branchDeveloperUse $codexbar-git-workflow
提交Release EngineerUse $codexbar-git-workflow commit flow
提交推送 / PRRelease EngineerUse $codexbar-git-workflow push/PR/Todoist flow
上传 / ArchiveRelease EngineerRun Step 7 archive/upload flow
安装到手机Release EngineerGenerate project if needed and install to a real device

Step 1 — Research

Before writing any code, understand the problem space.

  • Read relevant source code, SDK docs, and real synced data
  • Check upstream (steipete/CodexBar) for existing implementations or open PRs
  • Save findings to CodexBarMobile/Research/NNN-feature-name.md

Step 2 — Design

  • Write or update the research doc with chosen approach, data models, key files
  • Set status appropriately (see research status flow below)
  • Get user confirmation before proceeding to implementation

Research document status flow

draft → ready → in-progress → done
  │
  ├→ blocked-upstream   (waiting for upstream PR to merge)
  └→ dropped            (decided not to pursue)

Full status definitions and index are in CodexBarMobile/Research/README.md.

Step 3 — Implementation

  • Follow protocol-first design: define interfaces before writing logic
  • Phase large features into incremental, buildable steps
  • Follow all coding rules below (localization, file conventions, etc.)

Step 4 — Testing

  • Build with xcodebuild to verify compilation
  • Run unit tests if applicable
  • Verify on simulator or real device as needed
  • Add or extend XCTest / Swift Testing coverage for provider, parser, model, and settings changes. Prefer backticked sentence names for Swift Testing cases and clear fictitious model names when test data is synthetic.
  • Run focused swift test --filter ... checks for parser/provider fixes when possible, then the broader gate required by the release checklist.
  • Never run tests/checks or ad-hoc validation that can display macOS Keychain prompts. Live provider probes, browser-cookie imports, codexbar usage against real accounts, and real SecItem reads must be explicitly requested; otherwise use parser tests, stubs, test stores, or KeychainNoUIQuery.
  • App-group migration tests must inject dictionary-backed defaults, both snapshot URLs, a synthetic home, and a contained recording FileManager. UUID defaults suites and Keychain isolation flags do not isolate defaults search domains or filesystem access. Ordinary SettingsStore tests must not discover shared defaults or run app-group migration.
  • macOS CI is brittle around headless AppKit status/menu tests. Prefer covering menu behavior through stable state/model seams (MenuDescriptor, ProvidersPane, CodexAccountsSectionState, etc.) instead of constructing live NSStatusBar/NSMenu flows unless the AppKit wiring itself is the thing under test.

Multi-device iCloud Sync Compatibility Gate

When a release changes Mac→CloudKit→iOS sync, Shared payloads, CloudKit schema, provider display data, cache behavior, or cross-version rendering, testing must follow docs/ios-sync-compatibility-testing.md. This is the canonical 2 Mac × 2 iPhone old/new compatibility gate. The release Research/NNN-*/03-testing.md records that release's actual pass/fail/substituted evidence; it is not the source of the reusable rule.

CI Policy — Fork Invariant

CI uses the durable two-layer policy in docs/ci-policy.md:

  • Every PR update runs only PR Fast Checks (portable lint and policy guards).
  • Expensive macOS/Linux matrices run once after merge, selected by the final diff, or by explicit manual full-CI dispatch.
  • A verified upstream-sync/* merge reuses the published upstream release's successful heavy checks; fork-specific local/release gates still apply.
  • During upstream merges, preserve .github/workflows/pr-fast.yml, the fork trigger model in .github/workflows/ci.yml, and Scripts/check_ci_policy.sh. Never resolve an upstream workflow conflict by restoring heavy CI on PR synchronize events.

Scripts/check_ci_policy.sh is part of portable lint and fails if another workflow adds a PR update trigger or the fast workflow gains heavy jobs. This policy is repository state, not agent memory.

Step 5 — Documentation

After code is complete:

  1. Update CodexBarMobile/CHANGELOG.md — Keep a Changelog format (Added / Changed / Fixed)
  2. Update in-app release notes in MobileReleaseNotesCatalog (in ContentView.swift) — plain language, 4-language localized
    • Same MARKETING_VERSION = same release notes block. As long as only the build number changes (e.g. 1.0.0 (15) → 1.0.0 (16)), all changes belong to the same release notes entry. Before adding a new line:
      1. Check if an existing line already covers this feature area.
      2. If yes → merge the new detail into that line (rewrite it to include the update).
      3. If no existing line covers it → add a new line.
    • Only create a separate ReleaseNotesVersion entry when MARKETING_VERSION itself changes (e.g. 1.0.0 → 1.1.0).
  3. Update research doc status to done

Release notes — two audiences

FileAudienceStyle
CodexBarMobile/CHANGELOG.mdDevelopers, App ReviewTechnical, concise
MobileReleaseNotesCatalog in ContentView.swiftEnd users (in-app)Plain language, no jargon, localized

Step 6 — Branch, Commit & GitHub Handoff

When work needs a branch, commit, push, PR, review loop, branch cleanup, or Todoist status update, load and follow $codexbar-git-workflow.

Before merging any PR, wait for Codex Code Review on the exact current head, fix and retest every finding, reply and explicitly resolve every review thread, then request another review. PR Fast Checks being green is not sufficient. Run Scripts/check_pr_review_gate.sh <pr> immediately before merge. If review exceeds five rounds, pause before round six to audit the shared root/design problem and revise the approach; do not keep stacking symptom-level patches. The PR comment must use the exact non-empty Head, Repeated finding pattern, Root design/requirements problem, and Revised approach fields documented in $codexbar-git-workflow. Merge, tag creation, and public release/appcast work remain blocked until this gate passes. TestFlight is an independent beta workflow: an authorized upload does not require a PR, a clean CR gate, a merge, or remote CI completion. Keep local build/test, versioning, four-language notes, signing, and CloudKit Production checks; record the source commit and any known beta validation gaps. Before App Review/public release, verify that the selected ASC build was archived from the clean reviewed release code/resources/build configuration/version, using recorded source and artifact provenance. If review fixes changed shipped inputs or provenance is missing, archive/upload a new build; a later clean PR does not validate an older unreviewed binary.

For large Goals, the agent may make staged Git commits when the Goal or user authorizes implementation work. Do not push, merge, tag, publish a live release, or upload unless the user explicitly asks or the active Goal explicitly includes that handoff.

Version number format

iOS (project.yml) — these are CFBundle fields:

  • MARKETING_VERSION = user-facing version, e.g. 1.7.0 (feature releases only)
  • CURRENT_PROJECT_VERSION = build number, e.g. 129
  • Displayed as: 1.7.0 (129)

Mac (version.env) — fork-specific scheme with subdecimal patches. Full rules + decision tree + sparkle:version explanation: → docs/versioning.md (read this first when bumping Mac MARKETING_VERSION / BUILD_NUMBER / MOBILE_VERSION / UPSTREAM_VERSION).

Step 7 — Push & Release

CloudKit Environment — CRITICAL

All builds (Mac and iOS) must use CloudKit Production environment:

  • Mac (Scripts/package_app.sh): entitlements must include com.apple.developer.icloud-container-environment = Production
  • iOS (CodexBarMobile/CodexBarMobile.entitlements): must include com.apple.developer.icloud-container-environment = Production
  • iOS via Xcode debug: also uses Production (set in entitlements), so Xcode installs and TestFlight share the same CloudKit database

If this entitlement is missing, Mac defaults to Development environment and TestFlight iOS uses Production — data goes to different databases and sync appears broken.

CloudKit Schema Deploy — pre-release audit

Before every Mac release: run the audit in docs/cloudkit-deploy-audit.md to decide whether the Production schema needs a Dashboard deploy. Catches the recurring "I added a field but forgot to deploy" trap. Verdict table + grep commands + historical record live in that doc.

iOS — Archive & Upload

When the user asks to upload / archive / release:

# 1. Generate Xcode project
cd CodexBarMobile && xcodegen generate

# 2. Archive
xcodebuild -project CodexBarMobile.xcodeproj -scheme CodexBarMobile \
  -destination 'generic/platform=iOS' -configuration Release \
  -archivePath /tmp/CodexBarMobile.xcarchive archive -allowProvisioningUpdates

# 3. Export & upload to App Store Connect
xcodebuild -exportArchive \
  -archivePath /tmp/CodexBarMobile.xcarchive \
  -exportOptionsPlist /tmp/ExportOptions.plist \
  -allowProvisioningUpdates

Mac — Sign, Notarize & Release

Complete workflow: docs/RELEASING-MOBILE.md

Quick summary:

  1. Update CHANGELOG.md — Mobile changes first, upstream second
  2. ./Scripts/sign-and-notarize.sh — builds, signs with Developer ID Application: Yuxiao Wang (3TUERHN53E), notarizes
  3. Generate appcast with make_appcast.sh (set SPARKLE_DOWNLOAD_URL_PREFIX to full tag URL)
  4. Create GitHub release on o1xhack/CodexBar-Mobile (not upstream)
  5. Push appcast to mobile-dev

Build number: BUILD_NUMBER.MOBILE_VERSION (e.g. 53.1.1.0). See docs/sparkle.md for details.


Coding Rules

Version Control — Git/GitHub

Use Git/GitHub for branch, commit, push, PR, review, and branch cleanup work. Do not use jj unless the user explicitly re-enables it. Operational details belong in $codexbar-git-workflow, not in individual Goal prompts.

Operational guardrails

  • Do not modify Mac-only files such as Sources/ or Tests/ unless the user explicitly asks for Mac/upstream-sync/release work.
  • Never push to upstream; only push to origin.
  • README.md is the fork-owned iOS/Mac download entrypoint. During every upstream merge or conflict resolution, keep it byte-for-byte from the fork (mobile-dev) side; never accept or incidentally port the upstream README. After the merge, separately audit the upstream README diff for factual product, security, or troubleshooting changes and deliberately adapt only applicable text without replacing fork identity/download content. Scripts/check_fork_readme.sh enforces the resulting reviewed fork content hash. Do not update that hash merely to make an upstream sync pass; update it only with an intentional, separately reviewed fork README change.
  • Do not hand-edit .xcodeproj; update project.yml and run xcodegen generate.
  • Do not skip build numbers, changelog, release notes, CloudKit audit, or localization checks when their step applies.
  • Do not add full build/test matrices to PR update events. Follow docs/ci-policy.md; full CI belongs after merge or explicit manual dispatch.

Localization — Mandatory 4-Language Rule

Every user-facing text change MUST include all 4 languages. No exceptions.

Languages: English (en), Simplified Chinese (zh-Hans), Traditional Chinese (zh-Hant), Japanese (ja).

  • Source language is English
  • All strings use String(localized:) — the key is the English text itself
  • Translations live in Localizable.xcstrings (JSON format)
  • Every entry must have all 4 translations with "state": "translated"

Needs translation: UI labels, buttons, titles, descriptions, footers, placeholders, error messages, in-app release notes, onboarding text, empty states.

Does NOT need translation: Code comments, log messages, debug strings, accessibility identifiers, keys, enum raw values, format specifiers.

Self-check before finishing

  • Every new String(localized:) has a matching entry in Localizable.xcstrings
  • Every entry has all 4 languages with "state": "translated"
  • No "state": "new" or missing language keys left behind

Quick Reference

Trigger phrases

User saysAction
调研Steps 1–2 (research, save to Research/)
开发 / implementSteps 3–4 (implementation + tests)
开分支 / branchUse $codexbar-git-workflow
提交Use $codexbar-git-workflow commit flow
提交推送 / PRUse $codexbar-git-workflow push/PR/Todoist flow
上传 / ArchiveStep 7 (xcodegen, archive, upload to TestFlight)
安装到手机Generate project if needed, then install to a real device

Key paths

PathPurpose
AGENTS.mdThis file — repo routing and quality gates
.agents/skills/codexbar-git-workflow/SKILL.mdGit/GitHub branch, commit, push, PR, and handoff workflow
CodexBarMobile/Research/Feature research docs
CodexBarMobile/project.ymlBuild number + version
CodexBarMobile/CHANGELOG.mdTechnical changelog
CodexBarMobile/CodexBarMobile/ContentView.swiftMain views + in-app release notes
CodexBarMobile/CodexBarMobile/Localizable.xcstrings4-language translations
CodexBarMobile/CodexBarMobile/Views/Feature views
CodexBarMobile/CodexBarMobile/Models/Data models and formatters
CodexBarMobile/CodexBarMobile/Preview Content/PreviewData.swiftDemo / preview data
CodexBarMobile/Shared/Shared iCloud sync layer
version.envCurrent ship version + upstream alignment (UPSTREAM_VERSION, UPSTREAM_SYNC_DATE)
docs/versioning.mdMac/iOS versioning decision tree and Sparkle rules
docs/cloudkit-deploy-audit.mdCloudKit Production schema deploy audit
docs/ios-sync-compatibility-testing.mdCanonical 2 Mac × 2 iPhone old/new sync compatibility gate
docs/RELEASE-CHECKLIST.mdRelease/upstream-sync Definition of Done and acceptance checklist

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.