Skip to content

feat(skills): single-source skill compilation for pi + codex hosts - #14

Merged
heggria merged 2 commits into
mainfrom
feat/single-source-skills
Jul 3, 2026
Merged

heggria merged 2 commits into
mainfrom
feat/single-source-skills

Conversation

@heggria

@heggria heggria commented Jul 2, 2026

Copy link
Copy Markdown
Owner

Summary

Skills are now authored once in skills-src/taskflow/ and compiled per host by scripts/build-skills.mjs, replacing the two hand-maintained skill copies that had drifted (the Codex skill was a 103-line stub while the pi skill was 683 lines, and neither documented the incremental-recompute action suite).

Authoring model

skills-src/taskflow/
├─ entry.pi.md       — pi frontmatter + host binding (taskflow tool + /tf commands)
├─ entry.codex.md    — codex frontmatter + taskflow_* MCP tool table
├─ core.md           — shared body (phase types, control flow, common mistakes)
└─ patterns.md / advanced.md / configuration.md — shared companions

Host-only capabilities are wrapped in <!-- host:pi --> / <!-- host:codex --> blocks, so a host is never taught a tool it cannot reach (e.g. recompute/save/detach are pi-only; the approval-auto-reject caveat is codex-only). ~85% of the content is shared verbatim.

Content upgrades (both hosts)

  • Progressive loading: SKILL.md (core) → patterns.md (6 production archetypes, anti-pattern table, quality checklist, flow design ladder L0–L5) → advanced.md (flow{def} contract, workspace isolation; pi additionally gets Shared Context Tree + ir/provenance/why-stale/recompute) → configuration.md (knobs, caching, fingerprints)
  • pi SKILL.md now documents all 13 actions (ir/provenance/why-stale/recompute/cache-clear were previously invisible to the LLM)
  • Codex skill grows from a 103-line stub to the full capability surface minus MCP-unreachable features
  • "When NOT to use" sections, strictInterpolation guidance, and expect+retry baked into every example so agents copy best practice by default

Guardrails

  • npm run build:skills wired into npm run build
  • skills-build.test.ts: --check drift guard (CI fails if generated files diverge from skills-src/) + host-filtering semantic assertions
  • mcp-server.test.ts: flow-example verification extended from SKILL.md to all bundled skill files (≥5 complete flows must pass taskflow_verify)
  • RELEASE.md pre-flight gains a skill-coverage checklist; AGENTS.md updated to point at skills-src/

Test plan

  • 954/954 unit tests pass (npm test)
  • node scripts/build-skills.mjs --check green (no drift)
  • All complete flow examples in both hosts' skill files validate against the live schema (zero errors/warnings)

Skills are now authored ONCE in skills-src/taskflow/ and compiled per
host by scripts/build-skills.mjs, replacing the hand-maintained (and
drifting) pi/codex skill copies.

Authoring model:
- entry.pi.md / entry.codex.md — per-host frontmatter + host binding
  (taskflow tool actions + /tf commands vs taskflow_* MCP tools)
- core.md + patterns.md + advanced.md + configuration.md — shared body;
  host-only capabilities wrapped in <!-- host:pi --> / <!-- host:codex -->
  blocks so a host is never taught a tool it cannot reach

Content upgrades (both hosts):
- progressive loading: SKILL.md (core) → patterns.md (6 production
  archetypes, anti-pattern table, quality checklist, flow design ladder)
  → advanced.md (flow{def} contract, workspace isolation; pi also gets
  Shared Context Tree + the ir/provenance/why-stale/recompute suite)
  → configuration.md (knobs, caching, fingerprints)
- pi SKILL.md now documents all 13 actions (ir/provenance/why-stale/
  recompute/cache-clear were previously undocumented)
- codex skill grows from a 103-line stub to the full capability surface
  minus MCP-unreachable features, with an approval-auto-reject caveat
- "When NOT to use", strictInterpolation guidance, expect+retry baked
  into every example

Guardrails:
- npm run build:skills wired into npm run build
- skills-build.test.ts: --check drift guard + host-filtering assertions
- mcp-server.test.ts: example verification extended from SKILL.md to
  all bundled skill files (≥5 complete flows must pass taskflow_verify)
- RELEASE.md pre-flight + AGENTS.md updated to point at skills-src/
@heggria
heggria merged commit 8db3f27 into main Jul 3, 2026
6 checks passed
@heggria
heggria deleted the feat/single-source-skills branch July 3, 2026 06:17
heggria added a commit that referenced this pull request Jul 3, 2026
…ve + close follow-ups

Integrates the single-source skill architecture (#14) with the Top 3
features (#16): the score/reflexion/idempotent documentation, previously
edited directly in the generated SKILL.md files, is now authored ONCE in
skills-src/taskflow/core.md and compiled to both hosts via
build-skills.mjs. The drift guard (skills-build.test.ts) passes.

Also resolves all four deferred review follow-ups (issues #17-#20) so the
release ships without known debt:

- #17 (loop): PhaseState.loop.failures records every failed iteration
  (bounded to 20, sanitized). A reflexion loop that continues past
  failures no longer loses the intermediate diagnostics — only the
  terminal one previously survived in `error`.
- #18 (scorer-runtime): code-compiles now runs inside an isolated
  mkdtempSync directory used as the compiler cwd. Closes the predictable
  temp-name TOCTOU race AND stops `npx tsc` resolving a repo-planted
  node_modules/.bin/tsc from the phase cwd (defense-in-depth beyond the
  dynamic-flow scorer block). The cwd parameter is dropped from the
  scorer signature. (Process-group kill declined: the codebase's script
  phase kills the direct child too; orphans are bounded by the 30s
  timeout and cross-platform process groups would diverge from that.)
- #19 (docs): the shared core.md now documents {reflexion}, {loop.*},
  and the score.target/judge.task interpolation sites; codex SKILL.md
  reaches feature parity automatically through the single-source build.
- #20 (idempotent): a non-idempotent phase that re-executes on resume
  (a prior attempt had completed) now surfaces a warning so operators
  see the side effect re-firing; validation warns that idempotent:false
  on approval/flow phases is a no-op.

Docs (README, both SKILL.md sets) reflect the post-review score
semantics: auto-pass only when the judge cannot veto (no judge, or
weighted lower-bound), and the dynamic-flow code-compiles/regex blocks.

Suite: 1014/1014 (drift guard + 4 new regression tests for the
follow-ups). dist rebuilt.
@heggria heggria mentioned this pull request Jul 3, 2026
5 tasks done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant