soloship / src
AGENTS.md0 starsChanged 4 months agoMITView on GitHub
TypeScript source of the soloship npm CLI: cli.ts (Commander definition) routes to init.ts / upgrade.ts / rollback.ts / doctor.ts. The installers generate project guardrails: hooks.ts (inline-bash Claude Code hooks written to .claude/settings.local.json), rules.ts (markdown rules for .claude/rules/ + .codex/rules/), scaffold.ts, templates.ts, agents.ts, ci.ts. Compiles to dist/ via tsc. - bin/soloship.js shims to dist/cli.js — CLI surface changes are semver events (see .claude/rules/publish-version-bump.md). - installHooks() own-and-merges the hooks key of .claude/settings.local.json: it replaces only entries stamped _soloshipManaged (or legacy-fingerprinted) and preserves…
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.
Of the AGENTS.md files we read, the 31,700 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 repository55 other files it gives its agents.
- AGENTS.mdAGENTS.md
- scripts/AGENTS.mdAGENTS.md
- .cursor/rules/publish-version-bump.mdcCursor rule
- .cursor/rules/release-version-sync.mdcCursor rule
- antigravitySkill
- auditSkill
- autoplanSkill
- bootstrapSkill
- brainstormSkill
- browseSkill
- ceo-reviewSkill
- clarifySkill
- cleanupSkill
- code-reviewSkill
- codexSkill
- component-inventorySkill
- context-restoreSkill
- context-saveSkill
- critiqueSkill
- cronSkill
- csoSkill
- cursorSkill
- debugSkill
- deepen-planSkill
- design-reviewSkill
- devex-reviewSkill
- document-reviewSkill
- eng-reviewSkill
- executing-plansSkill
- fableSkill
- finishSkill
- frontend-designSkill
- grill-meSkill
- grokSkill
- implementSkill
- learnSkill
- office-hoursSkill
- onboardSkill
- plan-design-reviewSkill
- planSkill
- polishSkill
- qaSkill
- reviewSkill
- shipfastSkill
- shipthoroughSkill
- simplifySkill
- specSkill
- statusSkill
- subagent-driven-developmentSkill
- test-driven-developmentSkill
- ui-auditSkill
- ui-ux-pro-maxSkill
- using-git-worktreesSkill
- verification-before-completionSkill
- writing-plansSkill
The file
We split this AGENTS.md into the rules it gives an agent
2 rules. About 0 are common, 1 is distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 111
Every fail-safe hook needs must-fire behavioral fixtures (see __arch__/component-hook.test.ts — exec the generated script with the real …
- Distinctive: line 131
When a migration both deletes an old generated artifact and claims the content "moved" elsewhere, "deleted" and "moved" are separate claims …
≈ “Common” is an estimate: at least 1 in 5 of the 40,246 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.
Files
AGENTS.md — src/
Scope
TypeScript source of the soloship npm CLI: cli.ts (Commander definition)
routes to init.ts / upgrade.ts / rollback.ts / doctor.ts. The
installers generate project guardrails: hooks.ts (inline-bash Claude Code
hooks written to .claude/settings.local.json), rules.ts (markdown rules
for .claude/rules/ + .codex/rules/), scaffold.ts, templates.ts,
agents.ts, ci.ts. Compiles to dist/ via tsc.
Contracts
bin/soloship.jsshims todist/cli.js— CLI surface changes are semver events (see.claude/rules/publish-version-bump.md).installHooks()own-and-merges thehookskey of.claude/settings.local.json: it replaces only entries stamped_soloshipManaged(or legacy-fingerprinted) and preserves user-custom hooks; other settings keys are preserved. (Stale "overwrites the whole key" wording corrected 2026-07-23 — see the own-and-merge pitfall below.)hooks.tsexports SESSION_PRUNE_HOURS / SESSION_ACTIVE_MIN / SESSION_IDLE_MIN / DEPLOY_LOCK_STALE_MIN and rewrites them to<git-common-dir>/soloship/config.jsonon every SessionStart — skills read that file; never hardcode copies of these thresholds elsewhere.- Rule count and skill count are asserted by
scripts/validate-plugin-metadata.js— adding a rule inrules.tsor a skill dir requires bumping those constants. hooks.tsalso exportsBROWSER_CLAIM_STALE_MINandBROWSER_TEARDOWN_REMIND_MIN(added 2026-07-29) —BROWSER_CLAIM_STALE_MINdeliberately equalsSESSION_IDLE_MINrather than being its own number; when adding new "presumed dead" staleness logic, check for an existing threshold inconfig.jsonbefore inventing a new one.SessionEndis now a supported hook event (added toHOOK_EVENTSand the settings-merge machinery alongsidePreToolUse/PostToolUse/Stop/SessionStart) — it can only ever run cleanup on graceful exit; anything that must also catch the still-running-but-gone-quiet case needs a pairedStophook (see the browser-claim-teardown pitfall below).
Key Files
hooks.ts— builders returningbash -c '...'strings; guard-first (exit 0 outside git), no apostrophes inside the single-quoted script,\\"for quotes,\${VAR}for bash braces vs${TS_CONST}for TS interpolationrules.ts—getWorkflowRules()map of installed rule markdowndoctor.ts— read-only surface checks incl. the session coordination dirinit.ts/upgrade.ts— install + refresh orchestration (upgrade forces hook/rule refresh, preserves docs)
Pitfalls
Pitfall: Multibyte character adjacent to a shell variable eats the expansion
Added by soloship-learn 2026-07-06
In generated hook scripts, a non-ASCII character (e.g. an em-dash) placed
directly after $VAR gets its first UTF-8 byte absorbed into the variable
name, so the expansion silently renders empty plus garbage bytes. Always
write \${VAR} (braces) in the TS template and keep hook-emitted messages
ASCII-only. Verify generated scripts by executing them with real stdin
payloads — this class is invisible in source review. See
docs/solutions/runtime-errors/multibyte-char-adjacent-to-shell-var-eats-expansion-20260706.md.
Pitfall: installHooks must own-and-merge settings, never replace the block
Added by soloship-learn 2026-07-15
installHooks writes into the user's .claude/settings.local.json, which the
user can also add their own hooks to. It stamps every entry it creates with
_soloshipManaged: true and MERGES (keep unmarked user hooks, replace only its
own), rather than doing settings.hooks = hooks. A whole-block replace silently
wipes user-custom hooks on every re-init/upgrade. If you add a new hook, it is
stamped automatically by the merge path — do not reintroduce a bare assignment.
Legacy (pre-marker) Soloship hooks are cleaned up by isLegacySoloshipHook's
fingerprint regex; extend it when adding a hook whose command lacks an existing
signature. Test idempotency: run init 2–3× over a config with a foreign hook and
assert no duplication + the foreign hook survives. See
docs/solutions/patterns/installer-own-and-merge-config-not-replace-20260715.md.
Pitfall: Advisory teardown prose alone doesn't survive the collapse zone
Added by soloship-learn 2026-07-29
A "clean up X when done" instruction living only in skill markdown gets
forgotten at the tail of long sessions, exactly where context is thinnest.
SessionEnd alone isn't a full fix either — it only fires on a clean exit, so
a session that goes quiet but keeps running (moved on to other work, still
holding a browser claim) is invisible to it. The browser-claim system pairs
SessionEnd (releases on clean exit) with a Stop hook
(buildBrowserTeardownReminderScript) that checks the CURRENT session's own
claim file age on every reply-end and nags with the exact release command once
it has gone quiet past BROWSER_TEARDOWN_REMIND_MIN — mechanical, not
probabilistic. Reuse this two-hook pattern (SessionEnd + Stop, not either
alone) for any future "must release a shared resource, even if the session
never exits cleanly" case. See
docs/solutions/workflow-issues/browser-qa-false-blockers-credential-refusal-and-stale-claims-20260729.md.
Pitfall: Similar-looking MCP tool surfaces can be architecturally opposite
Added by soloship-learn 2026-07-29
Two MCP browser surfaces (Google's Chrome DevTools MCP and the Claude in
Chrome extension) both present as "a Chrome window with automation attached,"
but one launches its own fully isolated managed Chrome with no access to the
user's data and the other IS the user's real, logged-in everyday Chrome. A
first-draft rule conflated them under one label; the correction only happened
because the maintainer could observe a second application window opening that
clearly wasn't his daily browser. Before naming or ranking any browser/tool
MCP surface in a rule, verify empirically what it actually connects to (e.g.
mcp__claude-in-chrome__list_connected_browsers) rather than inferring from
the tool name or how it visually presents. See
docs/solutions/workflow-issues/browser-qa-false-blockers-credential-refusal-and-stale-claims-20260729.md.
Pitfall: macOS git grep ERE has no \b — boundary regexes silently match nothing
Added by soloship-learn 2026-07-23
Any ERE handed to git grep -E (or POSIX grep) inside a generated hook script
must not use \b — it's a GNU-only atom; BSD/macOS regcomp never matches it,
and a fail-safe hook (exit 0 on internal error, correct design) converts the
dead regex into "nothing to report." Use ([^A-Za-z0-9_]|$) boundary classes.
Every fail-safe hook needs must-fire behavioral fixtures (see
__arch__/component-hook.test.ts — exec the generated script with the real
HOOK_MODIFIED_FILE contract); a unit test of the builder string passes right
through this bug. See
docs/solutions/integration-issues/macos-git-grep-ere-no-word-boundary-20260723.md.
Pitfall: installRulesAt only writes at cwd — multi-level installs shadow and drift
Added by soloship-learn 2026-08-17
There is no global installer: installRulesAt writes <cwd>/.claude/rules/
only, and upgrade --force refreshes only that level. Running init/upgrade at
home, workspace, and project levels over time leaves same-named rule files at
multiple ancestor levels — Claude Code loads ALL of them, and the copies drift
(found live 2026-08-13: two contradictory deploy-from-main-only variants in
one session's context). Never assume the template in rules.ts is what sessions
read; diff the installed stack. Doctor's planned rule-stack report makes this
visible; removal is tombstone-by-byte-match only. See
docs/solutions/workflow-issues/2026-08-17-ancestor-rule-copies-shadow-and-drift.md.
Pitfall: deleting a generated surface doesn't guarantee its replacement landed
Added by soloship-learn 2026-08-27
When a migration both deletes an old generated artifact and claims the
content "moved" elsewhere, "deleted" and "moved" are separate claims that
need separate verification. upgrade pruned the four generated rule-mirror
directories on the premise that their text now lived in AGENTS.md's
## Safety gates section — true for a fresh init, false for an existing
project's upgrade, since upgrade preserves AGENTS.md by contract and
never regenerates it. The section only ever landed via init's fresh
generateAgentsMd() call; every existing project that ran upgrade lost
the rules entirely, with the tool reporting success. Caught only by running
the real CLI's upgrade against a real project with a pre-existing
AGENTS.md (MAPS, in a throwaway worktree) — the existing test suite had
full coverage of the prune and zero coverage of "does the destination
already have content before this migration ran." Fixed with a
marker-delimited ensureSafetyGatesSection (safety-gates.ts) that both
init and upgrade run before the prune. See
docs/solutions/workflow-issues/2026-08-27-upgrade-deletes-rule-mirrors-without-writing-agents-md-replacement.md.
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.

