.md file to compare - side-by-side diff against snappy-subagents
snappy-subagents
What it does for you
Puts several helpers to work in parallel and gathers their results.
What it produces
A recent result, so you can see the kind of work it returns.
loading…
How to get it
These run inside the Snappy workspace. Want this working in your business? I set skills like this up with you, in one focused week.
For developers how this skill is built, graded, and how it runs
at a glance- the short version
what's inside - the parts that make up a skill 3/4 present
A skill is just a few plain-text files. Only the main one is required. The rest are optional, added as the work needs them. This is what the skill is made of; how it runs is just below.
state/skills/snappy-subagents/SKILL.md
present
state/skills/snappy-subagents/api.ts
present
state/bin/snappy-subagents/
not present
state/skills/snappy-subagents/AGENTS.md
present
how it runs - the shared frame every skill uses 4/5 present
Every skill runs the same way. One part does the work, a separate part checks it, and a short loader hands the AI exactly what it needs for the job. Anything this skill doesn't use shows a one-line note saying why, on purpose, not by accident.
This skill doesn't fix its own gaps yet.
state/log/evals.ndjson - Compose any snappy-subagents UI through the current OpenUI path. Persist as artifact lang_body only when reusable.
what it has learned - fixes written back in over time sample
When a run hits something this skill didn't handle, the fix gets written back into the skill so it doesn't happen again. FIXED means it was corrected on the spot. LOGGED means it's queued for a bigger rewrite. Either way, the skill gets a little better and never makes the same mistake twice.
- Loading feedback rows…
how the work flows- who makes it, who checks it
what this step does
what this step does
SKILL.md- the skill, written out in plain English
snappy-subagents
Launch and coordinate parallel subagents in snappy-os. The PiD chain (verb → agent → loader → skill) only learns when each join writes back - this skill is the prose that tells an orchestrator how to dispatch work, how to keep N concurrent commits from clobbering each other, and how to close the loop with a [FIXED|LOGGED] line so the next dispatch starts sharper. Failure mode prevented: parallel agents that silently overwrite each other's work, or worse, return success without a writeback so the loader stays blind to gaps the agent already discovered.
Observed user requests
These are the prompts that triggered this skill being scaffolded:
- "/loop 10 minutes make sure you keep launching subagents and keep pushing them lets see if we can achieve homemade AGI"
- "Ok great please commit and push and then I need you to first tell me ok so all of these subagents that have been working"
- "Tell me what you think, because it seems to me this makes sense, but I just want to make sure that with this, can we ach"
- "before you do it can you please look up online first and learn just to make sure we benefit from what others have alread"
- "this is kind of nuts are you telling me we actually achieved our 'homemade agi'?"
The Steps section below is a first-draft response to this cluster - refine as eval scores accumulate.
Steps
1. Decide the fan-out shape
- One subagent per independent unit of work. If two tasks touch the
same file, queue them sequentially in one subagent - don't fan out.
- Prefer the in-session
Tasktool (Anthropic harness) over headless
claude -p for attended work. Headless is for Stop-hook drains, scheduled cron, or when the parent is about to exit. Both inherit the same memory; the subagent will read this loader on its first prompt.
2. Brief each subagent with a closed PiD
- Every subagent prompt MUST mandate a writeback line before exit. If the loader has a gap, edit this AGENTS.md inline.
git logon the file is the audit trail. No silent return edges - see memoryfeedback_subagent_prompts_must_close_pid. - Even if the work is fully satisfied with no edits, the subagent must
still emit a [FIXED] line confirming proof-of-life - silence trips agi-loop-validator.ts (see cockpit-layout/AGENTS.md Rule on consumer no-op).
- Tell the subagent which loader is its setpoint (
state/skills/<slug>/AGENTS.md)
so a P-fix lands in the right file, not a generic note.
3. Race-safe shared worktree (mandatory when N > 1)
- NEVER
git add -A,git add .,git stash -u, orgit commit -a-
they sweep other agents' WIP. Use explicit pathspec on commit: git commit -m "msg" -- <your-paths>. The pathspec on commit closes the TOCTOU window between git add and git commit.
- After
git pull --rebase origin main, re-Read your files before Edit -
the rebase silently rewrites the worktree. If a stash-pop conflict resolved by dropping your work, recover via git checkout stash@{0} -- <files>.
- Each parallel
xcodebuildMUST set-derivedDataPath /tmp/snappy-shell-build-<batch>
to avoid colliding artifacts. Cockpit-layout/AGENTS.md Rule 5 has the full incident catalog; cite it.
4. Drain on return - orchestrator IS the live drain
- After each subagent returns, read its writeback line from
state/log/loader-feedback.log and elevate the rule into the right loader IN-SESSION (don't wait for the cron Stop-hook drain). The next dispatch in the same session benefits - see memory feedback_orchestrator_is_live_drain.
- If the subagent claimed
[FIXED]but you don't see the file edit,
the subagent lied - re-dispatch with a stricter prompt and log a pid-validator [LOGGED] line.
5. Log + eval
import { score } from "../../lib/eval";
score("snappy-subagents", run_id, {
score: <1.0 if every subagent wrote back AND no clobber AND every reported FIX is on disk
| 0.5 if writebacks landed but at least one needed re-dispatch
| 0.0 if any subagent returned silently OR clobbered another agent's commit>,
primary_issue: <null | "silent-return" | "clobber" | "lied-fix" | ...>,
});
Eval
Actor: the thing that produces the output (a dispatch model, a CLI, or the state/lib/snappy-subagents.ts library if one exists). Auditor: the thing that judges (must be different - see CONSTITUTION invariant #3). Name both explicitly.
Score convention:
| Outcome | Score |
|---|---|
| Pass on first try | 1.0 |
| Failed first, auto-fix applied, re-check passed | 0.5 |
| Still failing or unrecoverable | 0.0 |
If you cannot name a deterministic auditor, switch the frontmatter to eval: manual and log to state/log/pending-eval.ndjson - but fight to avoid manual. Manual is the escape hatch that leaks the thesis.
Gotchas
- List concrete failure modes you hit while building. Examples: "API
returns 200 with empty body"; "round-tripped text has a , artifact where em-dashes used to be"; "cache file is stale after 12h."
- If a gotcha matches an entry in user memory (see
~/.claude/CLAUDE.md),
cite the memory name so future agents can follow the trail.
AGENTS.md- what the AI loads when this skill comes up
snappy-subagents - loader
Per-turn rules for fan-out + coordination. Full skill: state/skills/snappy-subagents/SKILL.md (5 Steps: fan-out shape → brief → race-safe → drain on return → log+eval). The PiD chain only learns when each agent writes back.
Critical Rules
- Compose any snappy-subagents UI through the current OpenUI path. Persist as artifact
lang_bodyonly when reusable.
- One subagent per independent unit. Same-file work must sequence in ONE subagent. Concurrent same-file = git clobber.
- Prefer in-session
Taskover headlessclaude -p. Headless: Stop-hook drains, cron, parent exit only. Task: attended loop. - EVERY subagent MUST emit writeback before exit. Even no-ops. Mandatory:
echo "[$(date -u +%FT%TZ)] <slug>: <gap or fix> [FIXED|LOGGED]" >> state/log/loader-feedback.log. Silence = hung consumer. - Tell subagent its AGENTS.md setpoint. Specify
state/skills/<slug>/AGENTS.mdas P-fix target so edits land correctly. - Pathspec commits only. NEVER:
-A,-a,-am,-u,stash -u. Use:git commit -m "msg" -- <paths>. - Re-Read files after
git pull --rebase. Rebase silently rewrites. Recover dropped work:git checkout stash@{0} -- <files>. - Parallel xcodebuild:
-derivedDataPath /tmp/snappy-shell-build-<batch>prevents artifact collisions. - Never
claude -pfrom attended if git active. Auto-regen child can clobber. Defer to Stop-hook. - FORBIDDEN paths in every brief. Subagent brief MUST list files it must NOT touch (e.g.
App.tsx,styles.css). Pattern:FORBIDDEN: web/src/App.tsx, web/src/styles.cssin heading. - Orchestrator = live drain. Read writeback on return, elevate rules IN-SESSION (not Stop-hook).
- Honest
[FIXED]claims must match disk. Missing edit = lie. Re-dispatch stricter. Actor ≠ auditor (CONSTITUTION #3). - Subagent model floor:
model: "sonnet". Haiku too weak for UI/Swift parity. Sonnet default. Haiku only for trivial data tasks. screencapture -xcaptures active screen. Non-attended: activate app first:osascript -e 'tell app "SnappyChat" to activate'.- Concurrent build-app.sh blocks chat-drive tests. Lock builds or accept test contamination.
Commands
| ui model | live composition via compose_inline, persisted as artifact lang_body, reopened with OpenArtifact |
| operation | command | |
|---|---|---|
| safe-commit | git commit -m "msg" -- <pathspec> (NEVER -a, -am, -A) | |
| safe-stash | git stash push -- <your-paths> (NEVER -u in shared) | |
| recover-stash | git checkout stash@{0} -- <files> | |
| detect-rebase-revert | wc -l <files> or git diff <ref> -- <files> | |
| parallel-xcode | xcodebuild -derivedDataPath /tmp/snappy-shell-build-<batch> ... | |
| writeback | Append [timestamp] slug: summary. [action_kind=type] to stdout or edit this AGENTS.md inline if gap found | |
| score | import { score } from "../../lib/eval"; score("snappy-subagents", run_id, { score, primary_issue }); | |
| reference | state/skills/snappy-subagents/SKILL.md | |
| logs | state/log/evals.ndjson (eval) \ | state/log/loader-feedback.log (writebacks) |
Score Convention
| outcome | score |
|---|---|
Every subagent wrote back AND no clobber AND every [FIXED] claim on disk | 1.0 |
| Writebacks landed but ≥1 needed re-dispatch | 0.5 |
Any subagent silent OR clobbered another commit OR lied [FIXED] | 0.0 |
Self-Test
- [ ] One subagent per independent unit; same-file work sequential?
- [ ] Prefer in-session Task over headless
claude -p? - [ ] Every subagent writes writeback, even no-ops?
- [ ] Tell subagent its AGENTS.md setpoint?
- [ ] Pathspec commits only (
-- <paths>), never-a/-A? - [ ] Re-Read files after rebase before Edit?
- [ ] Parallel xcodebuild:
-derivedDataPath /tmp/snappy-shell-build-<batch>? - [ ] Never nested
claude -pfrom attended context? - [ ] Every brief lists explicit FORBIDDEN paths?
- [ ] Read writebacks in-session, elevate rules immediately?
- [ ] Verify
[FIXED]claims on disk? - [ ] Agent/Task calls:
model: "sonnet"(floor) - haiku only for trivial data? - [ ] Activate app before
screencapture -xin non-attended context? - [ ] Concurrent builds locked or test contamination logged?
Found a gap? Edit this file. <!-- footer-injection-point -->
api.ts- the code it can call
#!/usr/bin/env npx tsx
/**
* state/skills/snappy-subagents/api.ts — sidecar for snappy-subagents.
*
* Coordination helper for parallel subagent dispatch. Emits a structured
* "subagent brief" (JSON) given a list of independent tasks, with each
* brief carrying the mandatory PiD writeback line. Also provides
* `validateBrief()` — a shape check that fails CI if a generated brief
* is missing the writeback contract.
*
* CLI:
* npx tsx api.ts brief <slug> '<gap-or-fix>'
* prints a single subagent prompt brief to stdout (JSON).
* npx tsx api.ts validate <file>
* reads <file> as text and exits 0 if it includes the writeback
* contract, exits 1 with a diagnostic otherwise.
*
* The actual orchestration (Task tool fan-out, headless `claude -p`) is
* not done here — the orchestrator is the calling agent. This file
* exists to encode the contract the prose describes (writeback, no
* silent return, race-safe pathspec) into machine-checkable form.
*/
export const SKILL_NAME = "snappy-subagents" as const;
const WRITEBACK_REGEX =
/loader-feedback\.log/;
const PATHSPEC_HINTS = [
/git\s+add\s+-A\b/,
/git\s+add\s+\.\b/,
/git\s+commit\s+-a\b/,
/git\s+stash\s+-u\b/,
];
export interface SubagentBrief {
slug: string;
loader_path: string;
gap_or_fix: string;
pid_writeback_line: string;
rules: string[];
}
export function brief(slug: string, gapOrFix: string): SubagentBrief {
return {
slug,
loader_path: `state/skills/${slug}/AGENTS.md`,
gap_or_fix: gapOrFix,
pid_writeback_line:
`echo "[$(date -u +%FT%TZ)] ${slug}: ${gapOrFix} [FIXED|LOGGED] action_kind=<kind>" >> state/log/loader-feedback.log`,
rules: [
"Read state/skills/" + slug + "/AGENTS.md before any tool call",
"Edit AGENTS.md inline when you discover a gap (P-fix; action_kind=loader-rewritten)",
"NEVER use `git add -A`, `git add .`, `git stash -u`, `git commit -a` — pathspec only",
"Re-Read files after `git pull --rebase` (rebase silently rewrites the worktree)",
"Emit the PiD writeback line before exit, even on no-op (proof-of-life required)",
],
};
}
export interface ValidateReport {
ok: boolean;
has_writeback: boolean;
banned_pathspec_uses: string[];
}
export function validateBrief(text: string): ValidateReport {
const hasWriteback = WRITEBACK_REGEX.test(text);
const banned = PATHSPEC_HINTS.filter((re) => re.test(text)).map((re) =>
re.source.replace(/\\\\b/g, "").replace(/\\s\+/g, " "),
);
return {
ok: hasWriteback && banned.length === 0,
has_writeback: hasWriteback,
banned_pathspec_uses: banned,
};
}
function isMain(): boolean {
try {
return import.meta.url === `file://${process.argv[1]}`;
} catch {
return false;
}
}
if (isMain()) {
const [cmd, ...rest] = process.argv.slice(2);
if (cmd === "brief") {
const slug = rest[0] ?? "<slug>";
const gap = rest.slice(1).join(" ") || "<gap or fix>";
console.log(JSON.stringify(brief(slug, gap), null, 2));
process.exit(0);
}
if (cmd === "validate") {
const file = rest[0];
if (!file) {
console.error("usage: api.ts validate <file>");
process.exit(2);
}
const text = require("fs").readFileSync(file, "utf8");
const report = validateBrief(text);
console.log(JSON.stringify(report, null, 2));
process.exit(report.ok ? 0 : 1);
}
console.log(
JSON.stringify(
{
skill: SKILL_NAME,
usage: ["api.ts brief <slug> '<gap>'", "api.ts validate <file>"],
},
null,
2,
),
);
process.exit(0);
}
scripts- helper scripts it can run
prose-only skill - 1 inline code block live in SKILL.md above (no state/bin/ sidecar yet).
how we check it- the checks, plus the last 10 runs
no recent runs logged - the eval contract is declared but nothing has been graded yet