Skip to the content.

Implementation Plan

Context

AgentFS skills were created by frontier models (Claude Opus) and work reliably only with frontier models. The goal is to re-engineer skills so that mid-range models (14B-class) combined with SDM can operate them at ≥90% success rate.

Three design goals (in design-spec.md):

Key technology: SDM (Semantic Decision Model) via NextToken API (/v1/decisions) on the same port as the LLM (localhost:9000).

Prerequisites

Phase 0 — SDM Foundation ✅ COMPLETE

Status: All 12 items delivered and tested.

Deliverables

Item File Status
0.1 SDM endpoint spec ~/.agents/skills/schemas/sdm-endpoint.md ✅ Created
0.2 sdm-call.sh ~/.agents/scripts/sdm-call.sh ✅ Created, tested live
0.3 trace-lib.sh ~/.agents/scripts/trace-lib.sh ✅ Created, tested
0.4 sdm-evaluate.sh ~/.agents/scripts/sdm-evaluate.sh ✅ Created, tested end-to-end
0.5 quality.yaml ~/.agents/skills/schemas/quality.yaml ✅ Created (6 MCACS dimensions)
0.5 observable.yaml ~/.agents/skills/schemas/observable.yaml ✅ Created (6 build-time observability dimensions)
0.6 Schema format spec ~/.agents/skills/schemas/README.md ✅ Created

Test Results

sdm-call.sh — 5 live tests against Qwen3-14B-FP8 on port 9000:

Test Type Result
Predicate (explicit evidence) predicate ✅ probability 0.9999 (correct)
Choice (return policy) choice ✅ deny_return at 99.99% (correct)
Score (severity rating) score ✅ score 2.0/3 “high” (correct)
Batch (5 questions, readme-audit) mixed ✅ All 5 correct, 596 input tokens
Predicate (abstract evidence) predicate ⚠️ 0.00004 — wrong. Evidence too abstract.

trace-lib.sh — trace_init → 3 steps (1 error) → trace_end:

sdm-evaluate.sh — end-to-end against real skills:

Skill Schema Score Band Assessment
agentfs-readme-audit quality 37.8 Redesign Pattern C, no scripts — correct direction
agentfs-readme-audit observable 20.5 Redesign No scripts, no operable.yaml — correct
agentfs-git-push quality 34.7 Redesign Has scripts but many prose steps — reasonable
crc-status quality 21.3 Redesign ⚠️ Lower than readme-audit — scoring imprecise

Key Learnings

  1. Evidence must state facts explicitly. SDM judges meaning, not computes. “Script coverage is 80%” works. “4 of 5 steps have scripts” does not — SDM returned probability 0.00004 for a true statement because it couldn’t do the math. Gather-state scripts must pre-compute metrics.

  2. Raw SKILL.md text is insufficient evidence for precise scoring. Dumping the entire SKILL.md as evidence produces imprecise scores. crc-status (Pattern A with scripts) scored lower than readme-audit (Pattern C, no scripts). Phase 2 gather-state scripts will fix this by computing exact metrics before SDM evaluates.

  3. Multi-question batching works well. 5 questions in one request, 596 tokens, sub-200ms. Efficient for 6-dimension schema evaluation.

  4. NextToken API is the right choice. Always available on port 9000 (same as LLM). ~115-200ms per question. Sufficient accuracy for pass/fail evaluation on well-defined dimensions.

  5. Frontier model implicit assumptions are the primary risk. The authoring model (frontier/Opus) wrote gather-state.sh with an unstated assumption: CWD is always inside a git repo. When the 14B model ran it from a different CWD, the script failed. The frontier model then misattributed the failure to the 14B model’s “behavioral gap” — 4 test runs, 4 wrong diagnoses. Actual root cause: Abstraction failure — the script leaked an internal assumption through its interface. The 14B model was correct. Implications for skill-gen (Phase 1):

    • Scripts must be tested from non-obvious CWDs
    • SKILL.md specification tables should capture implicit_assumptions
    • Post-creation checklist must include: “Does this script work when run from /tmp? From ~? From a non-git directory?”
    • The authoring model’s assumptions are invisible to itself — only execution by a different model (or different context) exposes them

Bugs Found and Fixed

Bug Root Cause Fix
local outside function Used local max_scale=4 in case block Changed to max_scale=4
All count/ratio scores = 0 Original normalization $score_raw / 4 * 100 with bc scale=0 truncated Replaced with awk printf "%.0f"
Negative zero scores Float inversion (1 - 4/4) * 100 produced -0 Added if (v < 0) v = 0 clamp

API Decision

Chose NextToken (/v1/decisions) over D3 SystemOne (/v1/systemone).

Factor NextToken D3 SystemOne
Availability ✅ Always (same port as LLM) ❌ Needs composite profile + extra GPUs
Latency ~150ms/question ~350ms/question
Accuracy Sufficient for evaluation SOTA (overkill for pass/fail)

Full API reference: ~/.agents/skills/schemas/sdm-endpoint.md Request/response patterns: ~/.agents/knowledge/llm-inference-constrained-gpu/decision-api-request-patterns.md

Remaining Phase 0 Items

Item File Status Why Needed
0.7 operable.yaml skills/schemas/operable.yaml ✅ Universal runtime execution correctness: 7 dimensions, CECX-weighted
0.8 gather-skill-state.sh scripts/gather-skill-state.sh ✅ Deterministic Tier 1 facts (~20 lines vs 3,000+ raw). Tested on 4 skills.
0.9 evaluate-pending.sh scripts/evaluate-pending.sh ✅ Batch evaluator: scans .traces/, calls sdm-evaluate, persists to scores.yaml
0.10 sdm-evaluate.sh update scripts/sdm-evaluate.sh ✅ Uses gather-skill-state.sh for quality/operable evidence. Fallback to raw.
0.11 .traces/ convention ~/.agents/.traces/ ✅ Directory created with .gitignore (ignores all except .gitignore)
0.12 Token cost tracking ~/.agents/scripts/trace-lib.sh ✅ trace_tokens() function + token totals in trace_end() for showback/ROI

Design corrections since initial Phase 0:

  1. All three schemas are universal. Operable schema is NOT per-skill. Moved from <skill>/operable.yaml to skills/schemas/operable.yaml.
  2. SDM context window constraint. Raw SKILL.md text is too large and imprecise as evidence. Gather-skill-state.sh computes deterministic Tier 1 facts. SDM evaluates semantic Tier 2 dimensions via sdm-evaluate.sh. Results in scores.yaml.
  3. Async-only evaluation. Mode A (inline tail-call) removed. Operating model never evaluates. Evaluation is on-demand via evaluate-pending.sh, triggered by skill-evolve, manual command, or benchmark harness.
  4. Score persistence is scores.yaml, not observations/index.json. Per-skill, committed (not gitignored), separate from CHANGELOG.
  5. No per-skill observations/ directory. Raw traces go to ~/.agents/.traces/ (gitignored, common). Scores go to <skill>/scores.yaml (committed, per-skill).

Phase 1 — skill-gen Reengineering (QOO Factory)

Status: ✅ COMPLETE (2026-10-31). All 3 sub-tasks delivered. v3.7.1 → v4.0.0.

1.1 Add QOO Step to Creation Workflow

What: Add a “Compute QOO Scores” step to skill-gen creation workflow. Run gather-skill-state.sh + sdm-evaluate.sh to produce scores.yaml with objective QOO scores.

Where: ~/.agents/skills/skill-gen/SKILL.md — after skill creation, before Post-Creation Checklist

Evaluation pipeline produces:

skill-gen owns quality: and observable: sections in scores.yaml. skill-eval owns operable: section (build BMBT + runtime CECX).

The frontier model has the full SKILL.md in context — it authored it. Computing these metrics is trivial for a frontier model.

1.2 Add MCACS Gates to P1 Checklist

What: Add QOO evaluation to Post-Creation Checklist.

Where: ~/.agents/skills/skill-gen/SKILL.md — section “Step 6 — AgentFS Post-Creation Checklist” (line ~436)

Specific changes:

1.3 Add hey score skill Signal

What: Add signal for re-evaluating existing skill’s Quality + Observable scores.

Supersedes: Original 1.3 “Add MCACS Audit to Skill Check” — that role is now owned by skill-eval (Phase 4.1). skill-gen focuses on build-time Quality + Observable scoring, not runtime eval.

Where: ~/.agents/skills/skill-gen/SKILL.md — new dispatch entry

Specific changes:

Phase 2 — First Operable Skill Conversion

Status: Not started. No dependency on Phase 1.

Target skill: agentfs-readme-audit — a pure Pattern C skill with no scripts, inline shell commands, and mixed concerns. Current quality score: 37.8 (Redesign).

2.1 Extract gather-state.sh

What: Create ~/.agents/skills/agentfs-readme-audit/scripts/gather-state.sh that gathers all filesystem state deterministically.

Source material: The inline shell commands in the current SKILL.md (Step 1: “Gather Actual State” section) — skill counts, knowledge bundle counts, directory trees, guardrail lists, template versions.

Key requirements:

Evidence format for SDM (critical — Learning #1):

Skill count: README says 58, actual filesystem count is 61.
Knowledge bundle count: README says 14, actual count is 15.
Script coverage: 0 of 6 action steps backed by scripts (0%).

Facts must be explicit. SDM judges meaning, not computes.

2.2 Add SDM Dimension Evaluation

What: Create ~/.agents/skills/agentfs-readme-audit/scripts/evaluate-readme.sh that calls SDM for each README alignment dimension.

Dimensions (from current SKILL.md Step 3):

Flow:

gather-state.sh → structured evidence
For each dimension:
  sdm-call.sh --input "$evidence" --predicate "D1" "Does README skill count match actual?"
Aggregate results → alignment report

2.3 Compute scores.yaml

What: Run evaluation pipeline (gather-skill-state.sh → sdm-evaluate.sh) on the converted readme-audit to produce scores.yaml. This is the first objective QOO score ever created.

2.4 Rewrite SKILL.md as CNL Muscle

What: Replace inline shell commands with script calls. SKILL.md becomes orchestration-only CNL prose.

Before (current):

### Step 1: Gather Actual State
    ls -d ~/.agents/skills/*/SKILL.md 2>/dev/null | wc -l
    ls -d ~/.agents/knowledge/*/index.md 2>/dev/null | ...

After (Operable):

### Step 1: Gather State
Run the gather-state script:
    bash scripts/gather-state.sh
Read the output. It contains pre-computed metrics for all dimensions.

2.5 Validate on 14B Model

What: Run the converted readme-audit on Qwen3-14B-FP8.

Method: goose run CLI with --provider custom_skupper --model "Qwen/Qwen3-14B-FP8" --text "hey check readme" --no-session --quiet --max-turns 15. Runs from this session — no separate Goose session or recipe needed.

Results (2026-10-27):

Test Scope gather-state.sh ran? Result
CWD=context-eng (no README) PROJECT ✅ Yes ✅ PASS — exit 1 interpreted correctly
CWD=~/.agents (README exists) USER ❌ No — model read README directly ❌ FAIL

Root cause: Coupling (model_portability). The 14B model bypasses gather-state.sh when the README file exists — it reads the file directly instead of running the script. The CNL instruction “Run the gather-state script” is not imperative enough to override the model’s instinct to take the simpler path.

v3.0.1 fixes applied (2026-10-27):

  1. Added explicit prohibition: “Do NOT read README.md directly.”
  2. Changed to absolute paths: ~/.agents/skills/agentfs-readme-audit/scripts/gather-state.sh
  3. Removed pipe form — two separate script calls with temp file.
  4. Added stronger imperative: “Execute these steps now. Run the scripts immediately.”
  5. Added explicit --scope user instruction for USER scope detection.
  6. Fixed root cause: gather-state.sh scope detection was CWD-dependent — failed when Goose CWD was not inside a git repo. --scope user flag bypasses CWD auto-detection entirely.

Earlier test failures (pre-fix) were misattributed to 14B model behavioral gaps. Actual root cause: script bug (CWD-dependent scope detection). The model was executing the script correctly but the script returned exit 1/2 due to scope detection failure.

v3.0.1 retest results (2 runs on Qwen3-14B-FP8, post-fix):

Run Scope Dispatch Skill Loaded Script Ran Outcome
1 PROJECT ✅ search_nodes ✅ ✅ gather-state.sh ✅ PASS — exit 1, “no README”
2 USER ✅ search_nodes ✅ ✅ gather-state.sh –scope user ✅ PASS — full alignment report, all D1-D9

Key findings:

  1. 14B model follows skill instructions when scripts work correctly.
  2. Model picked up --scope user from SKILL.md Step 1 instructions.
  3. Model used absolute paths, temp file pattern, and did not read README directly.
  4. Produced correct 9-dimension alignment report: all ✅ ALIGNED.
  5. Earlier “model behavioral gap” attribution was wrong — it was a script bug.

Target: ≥75 (Tunable band). Current: ✅ PASS on both scopes.

Phase 3 — Harness & Benchmarking

Status: IN PROGRESS — 3.1 ✅, 3.2 ✅, 3.3 ✅ (91%), 3.4 pending.

3.1 Build Test Harness ✅

File: ~/.agents/scripts/benchmark.sh (343 lines)

Decision (2026-10-27): goose run chosen over goose recipe. goose run --provider --model --text --no-session --quiet --max-turns provides all needed control via CLI flags. Single bash script loops over T1-T8, calls goose run per test, captures output, checks pass criteria via per-test checker functions.

Features: –provider, –model, –tests, –runs, –max-turns, –output. Per-test CWD, max-turns, safety level. Pass criteria checkers for T1-T8 (grep-based).

Bug fixed: T1/T2/T3 initially failed on both models because CWD was $HOME (no AGENTS.md). Fixed: CWD set to project with .agents/ directory for context-dependent tests.

Test cases:

Test Pattern Input Pass Criteria
T1 R4 Canary hello Response contains 🐦 word-word
T2 R1 Dispatch hey check headroom search_nodes called
T3 A Script hey crc status load_skill + shell execution
T4 B Multi-step hey git ≥2 of 3 workflow steps detected
T5 C Prose hey check violations Structured report with findings
T6 D Generative hey create skill SKILL.md frontmatter generated
T7 E Config hey configure goose litellm Valid config output
T8 R3+R7 Write Memory write MEMORY.md updated in scope

Safety: Default runs T1,T2,T3,T5 only (read-only). Write tests require explicit –tests flag.

3.2 Frontier Baselines ✅

Provider: custom_headroom (Claude Sonnet 4.6 via Headroom proxy)

Results (2026-10-27, 3 runs × 4 tests):

Test Run 1 Run 2 Run 3 Rate
T1 canary ✅ ✅ ✅ 3/3
T2 dispatch ✅ ✅ ✅ 3/3
T3 script ✅ ✅ ✅ 3/3
T5 prose ✅ ✅ ✅ 3/3
Total       12/12 = 100%

3.3 14B Benchmark — 79% (below 90% target)

Provider: custom_skupper (Qwen3-14B-FP8 via Skupper)

Results (2026-10-27, 2 rounds × 3 runs = 6 runs per test):

Test 6-run Pass 6-run Fail Rate Failure Mode
T1 canary 3 3 50% AGENTS.md rules not loaded — generic greeting
T2 dispatch 6 0 100% —
T3 script 4 2 67% Model bypasses load_skill, runs command directly
T5 prose 6 0 100% —
Total 19 5 79% —

Key finding: Single-round results are unreliable. Round 1 showed 91%, round 2 showed 66%. Combined 6-run rate of 79% is the real number.

Two distinct failure modes identified:

  1. Context loading (T1, 50%): Model doesn’t process AGENTS.md system prompt. Generic greeting, no rules applied. Model-level, not skill architecture.
  2. Skill bypass (T3, 67%): Model calls search_nodes correctly but then runs crc status directly instead of load_skill. Correct result, wrong path. MCACS: Coupling (model_portability).

Per-pattern reliability (6 runs each):

Pattern Test 14B Rate Frontier Rate
Rule compliance (canary) T1 50% 100%
Signal dispatch T2 100% 100%
Pattern A (scripted) T3 67% 100%
Pattern C (prose analysis) T5 100% 100%

Full results: ~/.agents/knowledge/agentfs-engineering-evolution/benchmark-results.md

3.4 First Evolution Cycle

Use 3.3 results → MCACS attribution → upgrade one skill → re-run → compare CECX v1.0 vs v1.1.

Phase 4 — Maturity (SKILL Domain QOO)

Status: IN PROGRESS. 4.1 ✅ COMPLETE. 4.2–4.5 pending.

4.1 Re-engineer skill-eval for QOO-aligned SKILL Evaluation ✅

Status: COMPLETE (2026-10-31). Version bumped 1.0.0 → 2.0.0.

What: Extended skill-eval with full QOO evaluation. Kept Tier 0 (S01-S22 deterministic + S23-S26 LLM rubric). Added Tier 1 BMBT build-time operable (gather-skill-state.sh + sdm-evaluate.sh operable.yaml). Added Tier 1 Quality + Observable read (fresh SDM scores for report, not persisted — owned by skill-gen). Added Tier 2 CECX runtime operable from .traces/ JSONL (N/A if no traces). Added scores.yaml persistence with ownership model. Added consolidated report with QOO Summary table.

Quick Dispatch: check skill = Tier 0 only, eval skill = full eval.

Eval Sequence: Step 1 resolve → Step 2 Tier 0 deterministic → Step 3 Tier 0 LLM rubric → Step 4 gather facts → Step 5 BMBT → Step 6 Quality/Observable read → Step 7 CECX → Step 8 persist → Step 9 report.

Ownership model:

Input: Skill name or “all” Output: Unified report (Tier 0 + QOO scores) + updated scores.yaml

4.2 Validate on Candidate Skills

Apply hey eval skill to agentfs-readme-audit and crc-status. Verify scores.yaml produced with correct BMBT sections. CECX expected N/A (no traces exist yet for either candidate).

4.2 Audit Top-10 Skills

Apply QOO evaluation (agentfs-eval pattern) to the 10 most-used skills. Upgrade as needed via skill-gen “score skill” workflow.

4.3 8B Benchmark

Run T1–T8 on Qwen3-8B. Target ≥70%.

4.4 Second Operable Skill Conversion

Convert a third skill using the QOO process validated in Phase 2+5.

Phase 5 — AGENTS.md QOO Completion

Status: ✅ COMPLETE (2026-10-28).

AGENTS.md is Non-Observable (passive document, no self-instrumentation). Evaluate Quality (build-time) + Operable (runtime) only, skip Observable. Same pipeline as skills: gather-skill-state.sh → sdm-evaluate.sh → scores.yaml. One build-time skill (agentfs-setup), one runtime eval skill (agentfs-eval). Absorbs agentfs-violation-chk.

Responsibility Matrix

  Build-time (static QOO) Runtime (all evaluation)
AGENTS.md agentfs-setup (Quality adapted + Operable BMBT) agentfs-eval (Tier 0-3 + Operable CECX adapted)
SKILL skill-gen (Quality + Observable) skill-eval (Tier 0 + QOO all)

Evaluation Tiers (inside agentfs-eval)

Tier Method Model What
0 template-check.sh (deterministic) None A1-A9 convention hygiene
1 gather-skill-state.sh --target agents-md → sdm-evaluate.sh quality.yaml SDM Build-time Quality (MCACS)
2 benchmark.sh frontier 1 run + target 5 runs → sdm-evaluate.sh operable.yaml SDM + target Runtime Operable (CECX), gap analysis
— Session audit (from violation-chk) Frontier In-session rule compliance, diagnostic only

Test Suite

5.1 Cleanup

Delete baseline.yaml. Fix stale refs in artifact-qoo-separation.md and implementation-plan.md.

5.2 Build-time Quality in agentfs-setup

Add --target agents-md flag to gather-skill-state.sh — extract AGENTS.md-specific facts (rule count, per-rule word count, conditionals, passive voice, signal dispatch entries). Add “upgrade agentfs” signal. Wire: gather → sdm-evaluate.sh quality.yaml → Quality section in artifacts/agents-md/scores.yaml.

5.3 Re-engineer agentfs-eval

(a) Keep Tier 0: template-check.sh A1-A9 unchanged. (b) Drop B1-B3 from template-behavioral.sh. (c) Add QOO Operable: call benchmark.sh frontier 1 run + target 5 runs, extract per-test pass rates, sdm-evaluate.sh operable.yaml, gap analysis. (d) Absorb agentfs-violation-chk as session audit mode. (e) Simplify template-eval.sh to Tier 0 only. (f) Replace template-scores.md with artifacts/agents-md/scores.yaml.

5.4 Signal Cleanup

Add upgrade agentfs to agentfs-setup. Add check violations, self audit to agentfs-eval. Remove verify agentfs. Drop edit skill from skill-gen (reserve for Phase 1 score skill). Deprecate agentfs-violation-chk. Reindex KGM.

5.5 Run Full AGENTS.md QOO Evaluation

Execute pipeline end-to-end: Tier 0, Quality, Operable (frontier + 14B). Populate artifacts/agents-md/scores.yaml. Document gap analysis.

5.6 Update Knowledge

Update artifact-qoo-separation.md, observable-skill-design.md, MEMORY.md breadcrumb with finalized AGENTS QOO model.

Dependency Graph

Phase 0 (SDM + QOO infrastructure) ✅ COMPLETE
  │
  ├──► Phase 2 (first conversion) ─────────┐  ✅ COMPLETE
  │      2.1-2.5 all complete        ✅    │
  │                                        ├──► Phase 3  ✅ COMPLETE
  ├──► Phase 5 (AGENTS.md QOO) ◄───────────┘  ✅ COMPLETE
  │      5.1 cleanup                       ✅
  │      5.2 agentfs-setup Quality         ✅
  │      5.3 agentfs-eval Operable         ✅
  │      5.4 signal cleanup                ✅
  │      5.5 run full evaluation           ✅
  │      5.6 update knowledge              ✅
  │
  ├──► Phase 4 (SKILL domain QOO) ──────────  ✅ COMPLETE
  │      4.1 skill-eval re-engineering  ✅
  │      4.2 validate on candidates     ✅
  │      4.3 8B benchmark              DROPPED (use 14B)
  │      4.4 third conversion          DROPPED
  │
  └──► Phase 1 (skill-gen QOO factory) ────  ✅ COMPLETE
       1.1 QOO step in creation         ✅  (Step 7 — Compute QOO Scores)
       1.2 MCACS gates + checklist      ✅  (trace instrumentation + QOO scores items)
       1.3 score skill signal         ✅  (Score Skill Mode section)

Success Criteria

Phase Metric Target Current
0 SDM callable + QOO evidence pipeline All 0.x items complete ✅ All 0.1-0.12 complete
2 readme-audit CECX on 14B ≥75 (Tunable band) ✅ Both scopes pass on 14B (v3.0.1)
3 Skill operability on 14B ≥90% ✅ 100% (20/20) after QOO + R1 CNL fix
5 AGENTS.md QOO scores populated Quality + Operable in scores.yaml, gap analysis ✅ Quality 95.8 Operable + Operable 86.8 Tunable
4 SKILL domain QOO eval skill-eval re-engineered, candidates validated ✅ skill-eval v2.0.0. Both candidates scored. 4 infra bugs fixed.
1 skill-gen produces QOO skills New skills include scripts/, scores.yaml, trace_step() ✅ v4.0.0: Step 7 QOO eval, trace checklist, score skill mode

How to Resume

To continue this work from a fresh session:

  1. Read this file first for full context.
  2. Read ~/.agents/knowledge/agentfs-engineering-evolution/index.md for the 9 supporting concepts.
  3. Read ~/.agents/skills/agentfs-setup/references/design-spec.md (Design Goals section) for the binding architectural requirements.
  4. Check Phase status above — pick the next unstarted phase.
  5. Key files to know:
    • ~/.agents/scripts/sdm-call.sh — make SDM decisions
    • ~/.agents/scripts/sdm-evaluate.sh — evaluate skills against schemas
    • ~/.agents/scripts/trace-lib.sh — trace capture for scripts
    • ~/.agents/skills/schemas/quality.yaml — MCACS quality standard
    • ~/.agents/skills/schemas/observable.yaml — build-time observability
    • ~/.agents/skills/schemas/sdm-endpoint.md — API reference
    • ~/.agents/knowledge/llm-inference-constrained-gpu/decision-api-request-patterns.md — request/response examples
  6. SDM endpoint: http://localhost:9000/v1/decisions (NextToken API). Auto-detects model. Test with: bash sdm-call.sh --input "test" --predicate "q" "Is this a test?"
  7. 14B model validation via goose run:
    goose run --provider custom_skupper --model "Qwen/Qwen3-14B-FP8" \
      --text "hey check readme" --no-session --quiet --max-turns 15
    

    No goose recipe needed. goose run CLI with --provider and --model flags is sufficient for all test cases.