OR Key
drop another .md file to compare - side-by-side diff against implement-spec

implement-spec

Builds a piece of work from your plan and checks the result.
description: "Triggers on prompt mention of 'implement-spec'."
personal 2 files 10 recent evals

What it does for you

Builds a piece of work from your plan and checks the result.

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.

Work with me
For developers how this skill is built, graded, and how it runs

at a glance- the short version

actor"subagent-general-purpose"}`.
auditor- SHA-diffs each targets[] path post vs pre
eval modeauto
categorySystem
stages5
dependsdispatch, eval

what's inside - the parts that make up a skill 2/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.

The skill
state/skills/implement-spec/SKILL.md present
the skill itself, in plain text
The main file. It says what the skill is and lays out the steps in plain English.
Code
state/lib/implement-spec.ts not present
code the skill can run
Optional. Many skills are just words and need no code at all.
Scripts
state/bin/implement-spec/ not present
helper scripts
Optional. Added when a skill has a few commands to run.
Loader
state/skills/implement-spec/AGENTS.md present
what the AI loads on the fly
Loaded automatically the moment this skill is needed. Kept short on purpose.

how it's graded - what counts as a good run 4 criteria · 4 deterministic

Each row is one thing a good run has to get right. deterministic means a quick check decides, pass or fail. judge means the AI reads the result and rates it. Grading each piece on its own (instead of one overall score) shows exactly where a run fell short, so the fix is obvious.

name
kind
check
eval_row_generated
deterministic
A new row for 'implement-spec' with a 'score' field is appended to 'state/log/evals.ndjson' at the end of execution, as indicated by 'score(\"implement-spec\", run_id, { ... })' in the skill's log+eval step.
no_scope_leak_detected
deterministic
The 'scope_leak' field in the 'implement-spec-done' chain.ndjson entry or eval row must be false, signifying that the auditor detected no unauthorized file modifications outside of the specified 'targets[]' by checking all canonical paths.
auditor_invoked_correctly
deterministic
The skill invokes 'state/bin/implement-spec-audit.ts <run_id>' before logging the final 'implement-spec-done' event, and the auditor's return data '{score, breakdown, notes}' is used to populate the eval row fields.
no_stub_code_introduced
deterministic
The 'stub_detected' field in the 'implement-spec-done' chain.ndjson entry or eval row must be false, indicating that the auditor did not find any placeholder text like 'TODO Wave' or 'not implemented' within the produced files.

how it runs - the shared frame every skill uses 5/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.

makes the work The worker
present
"subagent-general-purpose"}`. the worker
Does the actual work. Whatever it produces is what gets checked next.
checks the work The reviewer
present
- SHA-diffs each targets[] path post vs pre the checker
A separate checker grades the work, so the part that made it can't approve its own work.
frame
learns Self-correction
present
fixes itself learns from gaps
When a run hits a gap, the skill gets edited on the spot [FIXED] or queued for a bigger rewrite [LOGGED], so it keeps getting better.
tidies up Background fixes
present
queued for rewrite runs in the background
Bigger fixes that can't be made on the spot get queued and rewritten in the background later.
remembers Run history
present
state/log/evals.ndjson unknown runs
Every run is written down here, so the next time this skill is used it already knows how the last runs went.
Critical rules the things this skill must not get wrong
  1. NEVER trust the actor's self-summary — re-read produced files and SHA-diff them yourself
  2. NEVER allow writes outside targets[] — any escape is a 0.2 scope-leak penalty even if reverted
  3. ALWAYS dispatch the auditor as a separate process (implement-spec-audit.ts) — actor ≠ auditor or the score is invalid
  4. ALWAYS hard-fail Step 2 gate if brief is shorter than 40 chars or .machine_id is missing
  5. Serialize parallel dispatches that touch overlapping targets[] — concurrent waves both register scope-leak

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.

  1. Loading feedback rows…

how the work flows- who makes it, who checks it

inputs dispatcheval
actor "subagent-general-purpose"}`.
1 generator
invoke
actor = "subagent-general-purpose"}`.
npx tsx state/bin/implement-spec.ts <spec_ref> <targets...> <brief>
auditor - SHA-diffs each targets[] path post vs pre
2 auditor
inspect
auditor = - SHA-diffs each targets[] path post vs pre
npx tsx state/bin/implement-spec-audit.ts <run_id>
4 data
Log + eval
```typescript

SKILL.md- the skill, written out in plain English

implement-spec

Every file written by a subagent during Wave 1+2 of the snappy-os launch produced ZERO eval rows. program.md §4 says "Every run writes an eval score to state/log/evals.ndjson. This is non-optional." Build work was the one hole. This verb closes it.

Any time the system dispatches a subagent to produce files against a plan section, run implement-spec. It is the build-surface of the PID loop. Without it, every implementation run is dark, the quorum gate starves, and the thesis fails silently.

Steps

1. Scope - no side effects

Read spec_ref (load the plan section). Parse targets[] (must be absolute paths under ~/projects/snappy-os/ or ~/projects/snappy-skills/ or ~/projects/snappy-kernel/). Read each target's current SHA if it exists. Nothing written yet.

2. Gate

Hard-fail if:

  • spec_ref file doesn't resolve
  • any targets[] path escapes the three canonicals
  • brief is empty or shorter than 40 chars
  • .machine_id missing (bootstrap didn't run)

3. Act - dispatch the actor

Write chain.ndjson row {action: "implement-spec-dispatch", run_id, skill: "implement-spec", spec_ref, targets, actor: "subagent-general-purpose"}.

Dispatch the subagent with a self-contained brief including: spec_ref contents, target paths, hard rules ("do not touch anything outside targets"; "do not push or commit"; "report deliverables under 400 words"). Capture its return text into state/log/dispatches/<run_id>.md.

4. Audit - auditor ≠ actor

Invoke state/bin/implement-spec-audit.ts <run_id>. The auditor:

  • SHA-diffs each targets[] path post vs pre
  • Scope-leak check: walks canonicals, flags any file modified in the session that isn't in targets[] (penalty 0.2)
  • Stub detector: greps produced files for TODO Wave, placeholder, throw new Error("not implemented"), // stub (penalty 0.2 if any found)
  • Lint chain: runs every state/lint/*.ts whose scope overlaps produced files; counts fails (penalty 0.3 × fail-fraction)
  • Spec compliance: extracts bulleted requirements from spec_ref section; each bullet unmapped to a produced artifact = penalty (0.3 × unmapped-fraction)
  • Syntax/typecheck: node --check for .js, npx tsc --noEmit for .ts, bash -n for .sh

Returns {score, breakdown, notes}.

5. Log + eval

append("chain", { run_id, skill: "implement-spec", action: "implement-spec-done", spec_ref, score });
score("implement-spec", run_id, {
  score: auditor.score,
  primary_issue: auditor.primary_issue,
  spec_ref,
  files_touched: auditor.files_touched.length,
  scope_leak: auditor.scope_leak,
  stub_detected: auditor.stub_detected,
  lint_fail_count: auditor.lint_fail_count,
  unmapped_spec_bullets: auditor.unmapped_bullets.length,
  mode: "auto",
});

Eval

Actor: general-purpose subagent dispatched by state/bin/implement-spec.ts. Auditor: state/bin/implement-spec-audit.ts - independent process, reads filesystem state + lint results without any reference to actor's self-reported claims.

Score formula:

score = 1.0
     - 0.2 * scope_leak         (binary: any file outside targets)
     - 0.2 * stub_detected       (binary: any stub marker found)
     - 0.3 * (lint_fails / max(lints_run, 1))
     - 0.3 * (unmapped_bullets / max(spec_bullets, 1))

Clamp to [0.0, 1.0]. A perfect run = 1.0. A run that lands every file with green lints but leaked scope once = 0.8. A run that punted the whole job with TODO stubs = 0.5. A run that wrote nothing against a spec with requirements = 0.0.

Gotchas

  • Actor may self-report success while leaving stubs. The stub detector is why we read the files ourselves, not the actor's summary.
  • Scope leak during test-harness reinitialization (see Wave 2: wire-hooks agent touched real ~/.codex/hooks.json during smoke, then restored). The auditor treats any write outside targets[] as a leak even if reverted - the score reflects risk, not current state.
  • Spec bullets are hard to extract. The auditor uses a line-based heuristic: - **bold requirement** or 1. **bold** → bullet. Misses free-prose requirements. Accept the signal is lossy; a 0.7 score doesn't mean 30% incomplete, it means the signal is noisy. Tune via lint if too permissive.
  • Parallel waves clobber each other's targets[]: if two dispatches target overlapping paths simultaneously, both see scope-leak. Enforce serial execution per-target or partition in the parent.

Graduation

Graduated on day one - has state/bin/implement-spec.ts (executor) and state/bin/implement-spec-audit.ts (auditor). No prose-only phase because this is load-bearing from the first invocation. <!-- kernel-ok: documentation of the porting process / catalog -->

Rubric

criteria:
  - name: eval_row_generated
    kind: deterministic
    check: "A new row for 'implement-spec' with a 'score' field is appended to 'state/log/evals.ndjson' at the end of execution, as indicated by 'score(\"implement-spec\", run_id, { ... })' in the skill's log+eval step."
  - name: no_scope_leak_detected
    kind: deterministic
    check: "The 'scope_leak' field in the 'implement-spec-done' chain.ndjson entry or eval row must be false, signifying that the auditor detected no unauthorized file modifications outside of the specified 'targets[]' by checking all canonical paths."
  - name: auditor_invoked_correctly
    kind: deterministic
    check: "The skill invokes 'state/bin/implement-spec-audit.ts <run_id>' before logging the final 'implement-spec-done' event, and the auditor's return data '{score, breakdown, notes}' is used to populate the eval row fields."
  - name: no_stub_code_introduced
    kind: deterministic
    check: "The 'stub_detected' field in the 'implement-spec-done' chain.ndjson entry or eval row must be false, indicating that the auditor did not find any placeholder text like 'TODO Wave' or 'not implemented' within the produced files."

AGENTS.md- what the AI loads when this skill comes up

implement-spec - loader

Per-turn rules for the implement-spec skill. Full reference: state/skills/implement-spec/SKILL.md. Do not skip these.

Critical Rules

  • NEVER trust the actor's self-summary - re-read produced files and SHA-diff them yourself
  • NEVER allow writes outside targets[] - any escape is a 0.2 scope-leak penalty even if reverted
  • ALWAYS dispatch the auditor as a separate process (implement-spec-audit.ts) - actor ≠ auditor or the score is invalid
  • ALWAYS hard-fail Step 2 gate if brief is shorter than 40 chars or .machine_id is missing
  • Serialize parallel dispatches that touch overlapping targets[] - concurrent waves both register scope-leak

Commands

| ui dashboard | state/skills/implement-spec/resources/ui.openui | |invoke: npx tsx state/bin/implement-spec.ts <spec_ref> <targets...> <brief> |audit: npx tsx state/bin/implement-spec-audit.ts <run_id> |eval log: state/log/evals.ndjson (skill: "implement-spec") |dispatch transcript: state/log/dispatches/<run_id>.md

OpenUI Resource

  • Skill-owned OpenUI Lang resource: state/skills/implement-spec/resources/ui.openui. Read it before rendering or editing this skill's generated component surface.
  • Treat this resource as a first-class artifact of the skill, not a generic chat response. Improve it when the skill's user-facing output needs to become richer.
  • System resources compose OpenUI primitives and inherit SnappyChat tokens. Use ui_contract: branded in SKILL.md only for deliberate platform or client visuals.

Known Pitfalls

  • Stub markers (TODO Wave, placeholder, throw new Error("not implemented"), // stub) ship inside files an actor reports as complete - the stub detector exists because actor summaries lie
  • Spec-bullet extraction is line-based heuristic (- **bold** only); free-prose requirements are missed, so a 0.7 score means noisy signal not exactly 30% incomplete
  • A wire-hooks-style test that touches real config then "restores" still scores as scope-leak - risk is what's measured, not current state

Self-Test

An agent reading this should correctly:

  1. [ ] Refuse to score a run where the same script generated and audited?
  2. [ ] Reject a brief under 40 chars at the gate?
  3. [ ] Locate the executor at state/bin/implement-spec.ts and the auditor at state/bin/implement-spec-audit.ts?

Self-report

If this loader fell short, append a line:

echo "[$(date -u +%FT%TZ)] implement-spec: <what was missing>" >> state/log/loader-feedback.log

<!-- kernel-ok: historical attribution for the PID-loader pattern. -->

Self-correcting loader (PID feedback)

This is the rule that makes loaders learn. Ported from snappy-kernel, where it demonstrably worked: the snappy-dom-cartographer skill mapped Skool admin UI once, every later ship-agent inherited the full map for free.

Before you finish, do two things:

1. Fix gaps (P - proportional). MANDATORY. If this loader didn't cover your case - if you had to read another file, run an undocumented command, work around a wrong selector, or discover a quirk - you MUST attempt an Edit to this AGENTS.md before you log.

  • Default action: edit this file. Surgical. Add the missing line, table

row, or code example where it belongs. No restructuring.

  • Only LOGGED is allowed when: the fix needs >10 lines, spans multiple

files, or requires a structural rewrite. In that case the state/regen/drain.sh queue picks it up asynchronously.

  • "I didn't have time" / "it's minor" / "the next agent will figure it out"

are NOT valid reasons. Minor gaps compound - that's the whole point of this loop.

  • Concrete example of a valid P-fix: discover agent-browser screenshot

takes path positionally not as --output <path>. One line in a table. Edit it in. Do not just log it.

  • The goal: the next agent never has to leave the loader.

2. Log the result.

echo "[$(date -u +%FT%TZ)] implement-spec: <what was missing or fixed> [FIXED|LOGGED]" >> state/log/loader-feedback.log
  • FIXED = you patched this loader inline (P-fix).
  • LOGGED = too large for inline; the PostToolUse enqueue + Stop-hook drain

will rewrite the loader from scratch on next session-end.

Do not skip this. Every agent run must leave the system better than it found it. The loader is the setpoint; you are the sensor; the gap is the error signal; closing the gap is the correction.

api.ts- the code it can call

⚠ no api.ts - this skill has no typed action surface

scripts- helper scripts it can run

prose-only skill - 3 inline code blocks live in SKILL.md above (no state/bin/ sidecar yet).

how we check it- the checks, plus the last 10 runs

rubric auto no rubric declared
recent mean 0.88 · 10 runs actor/auditor: unverifiable
deps dispatch eval
timestamp verb score primary_issue artifact
2026-04-25 04:11Z - 1.00 - -
2026-04-21 15:58Z - 1.00 - -
2026-04-21 15:56Z - 1.00 - -
2026-04-21 03:53Z - 1.00 - -
2026-04-17 02:49Z - 0.38 - -
2026-04-17 02:49Z - 0.38 - -
2026-04-25 04:11Z - 1.00 - -
2026-04-21 15:58Z - 1.00 - -
2026-04-21 15:56Z - 1.00 - -
2026-04-21 03:53Z - 1.00 - -