Skip to content

Commit ca41e12

Browse files
tbitcsoz-agent
andcommitted
feat: M006 session governance migration, checkpoint command, modern web types, docs
M006 migration — auto-inject Session Governance Protocol into AGENTS.md: - Detects 4 sentinel strings; no-op when already present (idempotent) - Injects heartbeat + preflight gate + drift detection + checkpoint-in-summary section AFTER Session Bootstrap, BEFORE next ## heading - Backs up AGENTS.md to .specsmith/agents.md.m006.bak before patching - Runs automatically via specsmith migrate-project and specsmith upgrade --full - Registered as version=6 in MigrationRegistry specsmith checkpoint command (REQ-351): - Best-effort: phase, audit health, REQ/TEST counts, ESDB chain, recent WIs, last preflight — never fails even on projects with no ESDB or LEDGER - --json: structured payload for machine consumers - Human output: bordered GOVERNANCE ANCHOR block with footer instruction Modern web framework project types (REQ-353): - config.py: NEXTJS_APP, NUXT_APP, SVELTEKIT_APP, REMIX_APP, ASTRO_SITE - tools.py: full ToolSet for each (eslint, tsc, vitest/jest, playwright, npm audit) - _TYPE_LABELS: human-readable labels for all 5 types AGENTS.md template: - Session Governance Protocol section added to agents.md.j2 so all newly scaffolded/upgraded projects get the checkpoint + preflight + heartbeat rules specsmith-session-governance skill (governance domain): - Full session protocol as an installable skill - Explains why agents drift, the three mandatory rules, drift self-check Governance: - REQ-351/352/353 + TEST-351/352/353 added and synced (308->311 reqs, 311->314 tests) - REQUIREMENTS.md + TESTS.md regenerated - api_surface.json fixture updated GitHub issues filed for later: - #179: Codity.ai — skill + CLI adapter + AGENTS rule (tri-layer) - #180: Chumlab UI — skill-only initially (stealth, npm not yet public) Co-Authored-By: Oz <oz-agent@warp.dev>
1 parent 50c5645 commit ca41e12

14 files changed

Lines changed: 839 additions & 21 deletions

File tree

.specsmith/requirements.json

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3081,5 +3081,35 @@
30813081
"test_ids": [
30823082
"TEST-350"
30833083
]
3084+
},
3085+
{
3086+
"id": "REQ-351",
3087+
"title": "specsmith checkpoint Governance Anchor Command",
3088+
"description": "specsmith MUST provide a checkpoint CLI command that emits a compact GOVERNANCE ANCHOR summarising the current project state: project name (from scaffold.yml), AEE phase with readiness percentage, audit health and failed check count, REQ count, TEST count, ESDB record count with chain validity, up to 3 recent WI- identifiers from LEDGER.md, and the last preflight acceptance line. With --json it MUST emit a JSON payload containing ts, project, phase, phase_label, phase_pct, health, audit_failed, req_count, test_count, esdb_records, esdb_chain_valid, recent_wis, last_preflight, and anchor fields. Without --json it MUST emit a human-readable bordered GOVERNANCE ANCHOR block with a footer instructing agents to include it verbatim in any context summary. All data gathering MUST be best-effort (exceptions silently swallowed) so the command never fails even on projects with no ESDB or LEDGER.",
3089+
"source": "ARCHITECTURE.md §Session Governance Protocol",
3090+
"status": "implemented",
3091+
"test_ids": [
3092+
"TEST-351"
3093+
]
3094+
},
3095+
{
3096+
"id": "REQ-352",
3097+
"title": "M006 Session Governance Migration Auto-injects Protocol into AGENTS.md",
3098+
"description": "specsmith MUST include migration M006 (version=6) that detects whether AGENTS.md contains any of the sentinel strings 'specsmith checkpoint', 'Session Governance Protocol', 'GOVERNANCE ANCHOR', or 'governance heartbeat'. When none are present, M006 MUST back up AGENTS.md to .specsmith/agents.md.m006.bak and inject the full Session Governance Protocol section (heartbeat every 8-10 turns, preflight gate, drift detection checklist, checkpoint-in-summary rule, session end). M006 MUST be idempotent (re-running when section is present is a no-op), non-destructive (original always backed up), and registered in MigrationRegistry so it runs automatically via specsmith migrate-project and specsmith upgrade --full.",
3099+
"source": "ARCHITECTURE.md §Session Governance Protocol",
3100+
"status": "implemented",
3101+
"test_ids": [
3102+
"TEST-352"
3103+
]
3104+
},
3105+
{
3106+
"id": "REQ-353",
3107+
"title": "Modern Web Framework Project Types",
3108+
"description": "specsmith MUST support the following modern web framework project types in addition to the existing web-frontend and fullstack-js types: nextjs-app (Next.js / React with SSR/SSG, next lint, jest/playwright), nuxt-app (Nuxt.js / Vue, vitest, playwright), sveltekit-app (SvelteKit, vitest, playwright), remix-app (Remix React, vitest, playwright), astro-site (Astro static/SSR, vitest, playwright). Each MUST have a corresponding ToolSet entry in the tool registry with appropriate lint, typecheck, test, security, build, and format tools. Each MUST appear in _TYPE_LABELS with a human-readable label.",
3109+
"source": "ARCHITECTURE.md §Implemented Specsmith System",
3110+
"status": "implemented",
3111+
"test_ids": [
3112+
"TEST-353"
3113+
]
30843114
}
30853115
]

.specsmith/testcases.json

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3419,5 +3419,38 @@
34193419
"input": "YAML req with platform='linux', boundary='OS', confidence='0.9'; run_sync; inspect JSON",
34203420
"expected_behavior": "JSON entry has platform, boundary, confidence keys; absent fields not present",
34213421
"confidence": 0.9
3422+
},
3423+
{
3424+
"id": "TEST-351",
3425+
"title": "specsmith checkpoint Emits GOVERNANCE ANCHOR with Required Fields",
3426+
"description": "specsmith checkpoint --json on a project with scaffold.yml MUST exit 0 and return JSON containing ts (ISO-8601), project (string), phase (string), phase_label, phase_pct (int), health (string), audit_failed (int), req_count (int), test_count (int), esdb_records (int), esdb_chain_valid (bool), recent_wis (list), last_preflight (string), and anchor ('SPECSMITH-ANCHOR-' prefix). Without --json it MUST print a line containing 'GOVERNANCE ANCHOR'. Both forms MUST exit 0 on a project with no ESDB or LEDGER (best-effort, never throws).",
3427+
"requirement_id": "REQ-351",
3428+
"type": "cli",
3429+
"verification_method": "pytest",
3430+
"input": "specsmith checkpoint --json --project-dir tmp; specsmith checkpoint --project-dir tmp",
3431+
"expected_behavior": "JSON has all required fields; human output contains GOVERNANCE ANCHOR; exit 0 in both cases",
3432+
"confidence": 0.95
3433+
},
3434+
{
3435+
"id": "TEST-352",
3436+
"title": "M006 Injects Session Governance Protocol into AGENTS.md",
3437+
"description": "SessionGovernanceMigration().run(tmp_path) on a project with AGENTS.md that lacks 'specsmith checkpoint' MUST inject the Session Governance Protocol section, create .specsmith/agents.md.m006.bak, and return success=True with 'AGENTS.md' in files_modified. Re-running MUST be a no-op (idempotent). Running with dry_run=True MUST report what would change without writing. rollback() MUST restore AGENTS.md from the backup. M006 MUST appear in MigrationRegistry.all().",
3438+
"requirement_id": "REQ-352",
3439+
"type": "integration",
3440+
"verification_method": "pytest",
3441+
"input": "SessionGovernanceMigration().run(tmp_path); dry_run=True; rollback(); re-run after injection",
3442+
"expected_behavior": "Protocol injected; backup created; dry_run no writes; rollback restores; idempotent; registry includes v6",
3443+
"confidence": 0.95
3444+
},
3445+
{
3446+
"id": "TEST-353",
3447+
"title": "Modern Web Framework Types Have Tool Registry Entries",
3448+
"description": "list_tools_for_type(ProjectType.NEXTJS_APP) MUST return a ToolSet with 'next build' in build and 'eslint' in lint. list_tools_for_type(ProjectType.NUXT_APP) MUST have 'nuxt build' in build. list_tools_for_type(ProjectType.SVELTEKIT_APP) MUST have 'vite build'. list_tools_for_type(ProjectType.REMIX_APP) MUST have 'remix vite:build'. list_tools_for_type(ProjectType.ASTRO_SITE) MUST have 'astro build'. All five types MUST appear in _TYPE_LABELS with non-empty human-readable labels.",
3449+
"requirement_id": "REQ-353",
3450+
"type": "unit",
3451+
"verification_method": "pytest",
3452+
"input": "list_tools_for_type for each new type; check _TYPE_LABELS",
3453+
"expected_behavior": "Each type has correct build tool; all five types in _TYPE_LABELS",
3454+
"confidence": 0.95
34223455
}
34233456
]

docs/REQUIREMENTS.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2466,3 +2466,27 @@
24662466
- **Source:** ARCHITECTURE.md §YAML-Native Governance Layer
24672467
- **Test_Ids:** ['TEST-350']
24682468

2469+
## REQ-351. specsmith checkpoint Governance Anchor Command
2470+
- **ID:** REQ-351
2471+
- **Title:** specsmith checkpoint Governance Anchor Command
2472+
- **Description:** specsmith MUST provide a checkpoint CLI command that emits a compact GOVERNANCE ANCHOR summarising the current project state: project name (from scaffold.yml), AEE phase with readiness percentage, audit health and failed check count, REQ count, TEST count, ESDB record count with chain validity, up to 3 recent WI- identifiers from LEDGER.md, and the last preflight acceptance line. With --json it MUST emit a JSON payload containing ts, project, phase, phase_label, phase_pct, health, audit_failed, req_count, test_count, esdb_records, esdb_chain_valid, recent_wis, last_preflight, and anchor fields. Without --json it MUST emit a human-readable bordered GOVERNANCE ANCHOR block with a footer instructing agents to include it verbatim in any context summary. All data gathering MUST be best-effort (exceptions silently swallowed) so the command never fails even on projects with no ESDB or LEDGER.
2473+
- **Status:** implemented
2474+
- **Source:** ARCHITECTURE.md §Session Governance Protocol
2475+
- **Test_Ids:** ['TEST-351']
2476+
2477+
## REQ-352. M006 Session Governance Migration Auto-injects Protocol into AGENTS.md
2478+
- **ID:** REQ-352
2479+
- **Title:** M006 Session Governance Migration Auto-injects Protocol into AGENTS.md
2480+
- **Description:** specsmith MUST include migration M006 (version=6) that detects whether AGENTS.md contains any of the sentinel strings 'specsmith checkpoint', 'Session Governance Protocol', 'GOVERNANCE ANCHOR', or 'governance heartbeat'. When none are present, M006 MUST back up AGENTS.md to .specsmith/agents.md.m006.bak and inject the full Session Governance Protocol section (heartbeat every 8-10 turns, preflight gate, drift detection checklist, checkpoint-in-summary rule, session end). M006 MUST be idempotent (re-running when section is present is a no-op), non-destructive (original always backed up), and registered in MigrationRegistry so it runs automatically via specsmith migrate-project and specsmith upgrade --full.
2481+
- **Status:** implemented
2482+
- **Source:** ARCHITECTURE.md §Session Governance Protocol
2483+
- **Test_Ids:** ['TEST-352']
2484+
2485+
## REQ-353. Modern Web Framework Project Types
2486+
- **ID:** REQ-353
2487+
- **Title:** Modern Web Framework Project Types
2488+
- **Description:** specsmith MUST support the following modern web framework project types in addition to the existing web-frontend and fullstack-js types: nextjs-app (Next.js / React with SSR/SSG, next lint, jest/playwright), nuxt-app (Nuxt.js / Vue, vitest, playwright), sveltekit-app (SvelteKit, vitest, playwright), remix-app (Remix React, vitest, playwright), astro-site (Astro static/SSR, vitest, playwright). Each MUST have a corresponding ToolSet entry in the tool registry with appropriate lint, typecheck, test, security, build, and format tools. Each MUST appear in _TYPE_LABELS with a human-readable label.
2489+
- **Status:** implemented
2490+
- **Source:** ARCHITECTURE.md §Implemented Specsmith System
2491+
- **Test_Ids:** ['TEST-353']
2492+

docs/TESTS.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2902,3 +2902,36 @@
29022902
- **Expected Behavior:** JSON entry has platform, boundary, confidence keys; absent fields not present
29032903
- **Confidence:** 0.9
29042904

2905+
## TEST-351. specsmith checkpoint Emits GOVERNANCE ANCHOR with Required Fields
2906+
- **ID:** TEST-351
2907+
- **Title:** specsmith checkpoint Emits GOVERNANCE ANCHOR with Required Fields
2908+
- **Description:** specsmith checkpoint --json on a project with scaffold.yml MUST exit 0 and return JSON containing ts (ISO-8601), project (string), phase (string), phase_label, phase_pct (int), health (string), audit_failed (int), req_count (int), test_count (int), esdb_records (int), esdb_chain_valid (bool), recent_wis (list), last_preflight (string), and anchor ('SPECSMITH-ANCHOR-' prefix). Without --json it MUST print a line containing 'GOVERNANCE ANCHOR'. Both forms MUST exit 0 on a project with no ESDB or LEDGER (best-effort, never throws).
2909+
- **Requirement ID:** REQ-351
2910+
- **Type:** cli
2911+
- **Verification Method:** pytest
2912+
- **Input:** specsmith checkpoint --json --project-dir tmp; specsmith checkpoint --project-dir tmp
2913+
- **Expected Behavior:** JSON has all required fields; human output contains GOVERNANCE ANCHOR; exit 0 in both cases
2914+
- **Confidence:** 0.95
2915+
2916+
## TEST-352. M006 Injects Session Governance Protocol into AGENTS.md
2917+
- **ID:** TEST-352
2918+
- **Title:** M006 Injects Session Governance Protocol into AGENTS.md
2919+
- **Description:** SessionGovernanceMigration().run(tmp_path) on a project with AGENTS.md that lacks 'specsmith checkpoint' MUST inject the Session Governance Protocol section, create .specsmith/agents.md.m006.bak, and return success=True with 'AGENTS.md' in files_modified. Re-running MUST be a no-op (idempotent). Running with dry_run=True MUST report what would change without writing. rollback() MUST restore AGENTS.md from the backup. M006 MUST appear in MigrationRegistry.all().
2920+
- **Requirement ID:** REQ-352
2921+
- **Type:** integration
2922+
- **Verification Method:** pytest
2923+
- **Input:** SessionGovernanceMigration().run(tmp_path); dry_run=True; rollback(); re-run after injection
2924+
- **Expected Behavior:** Protocol injected; backup created; dry_run no writes; rollback restores; idempotent; registry includes v6
2925+
- **Confidence:** 0.95
2926+
2927+
## TEST-353. Modern Web Framework Types Have Tool Registry Entries
2928+
- **ID:** TEST-353
2929+
- **Title:** Modern Web Framework Types Have Tool Registry Entries
2930+
- **Description:** list_tools_for_type(ProjectType.NEXTJS_APP) MUST return a ToolSet with 'next build' in build and 'eslint' in lint. list_tools_for_type(ProjectType.NUXT_APP) MUST have 'nuxt build' in build. list_tools_for_type(ProjectType.SVELTEKIT_APP) MUST have 'vite build'. list_tools_for_type(ProjectType.REMIX_APP) MUST have 'remix vite:build'. list_tools_for_type(ProjectType.ASTRO_SITE) MUST have 'astro build'. All five types MUST appear in _TYPE_LABELS with non-empty human-readable labels.
2931+
- **Requirement ID:** REQ-353
2932+
- **Type:** unit
2933+
- **Verification Method:** pytest
2934+
- **Input:** list_tools_for_type for each new type; check _TYPE_LABELS
2935+
- **Expected Behavior:** Each type has correct build tool; all five types in _TYPE_LABELS
2936+
- **Confidence:** 0.95
2937+

docs/requirements/overflow.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,3 +294,46 @@
294294
Absent fields MUST be omitted from the JSON entry (not written as null).
295295
source: ARCHITECTURE.md §YAML-Native Governance Layer
296296
status: implemented
297+
- id: REQ-351
298+
title: specsmith checkpoint Governance Anchor Command
299+
description: >-
300+
specsmith MUST provide a checkpoint CLI command that emits a compact GOVERNANCE ANCHOR
301+
summarising the current project state: project name (from scaffold.yml), AEE phase with
302+
readiness percentage, audit health and failed check count, REQ count, TEST count,
303+
ESDB record count with chain validity, up to 3 recent WI- identifiers from LEDGER.md,
304+
and the last preflight acceptance line. With --json it MUST emit a JSON payload containing
305+
ts, project, phase, phase_label, phase_pct, health, audit_failed, req_count, test_count,
306+
esdb_records, esdb_chain_valid, recent_wis, last_preflight, and anchor fields.
307+
Without --json it MUST emit a human-readable bordered GOVERNANCE ANCHOR block with a
308+
footer instructing agents to include it verbatim in any context summary. All data
309+
gathering MUST be best-effort (exceptions silently swallowed) so the command never
310+
fails even on projects with no ESDB or LEDGER.
311+
source: ARCHITECTURE.md §Session Governance Protocol
312+
status: implemented
313+
- id: REQ-352
314+
title: M006 Session Governance Migration Auto-injects Protocol into AGENTS.md
315+
description: >-
316+
specsmith MUST include migration M006 (version=6) that detects whether AGENTS.md
317+
contains any of the sentinel strings 'specsmith checkpoint', 'Session Governance Protocol',
318+
'GOVERNANCE ANCHOR', or 'governance heartbeat'. When none are present, M006 MUST
319+
back up AGENTS.md to .specsmith/agents.md.m006.bak and inject the full Session Governance
320+
Protocol section (heartbeat every 8-10 turns, preflight gate, drift detection checklist,
321+
checkpoint-in-summary rule, session end). M006 MUST be idempotent (re-running when section
322+
is present is a no-op), non-destructive (original always backed up), and registered in
323+
MigrationRegistry so it runs automatically via specsmith migrate-project and
324+
specsmith upgrade --full.
325+
source: ARCHITECTURE.md §Session Governance Protocol
326+
status: implemented
327+
- id: REQ-353
328+
title: Modern Web Framework Project Types
329+
description: >-
330+
specsmith MUST support the following modern web framework project types in addition to
331+
the existing web-frontend and fullstack-js types: nextjs-app (Next.js / React with
332+
SSR/SSG, next lint, jest/playwright), nuxt-app (Nuxt.js / Vue, vitest, playwright),
333+
sveltekit-app (SvelteKit, vitest, playwright), remix-app (Remix React, vitest,
334+
playwright), astro-site (Astro static/SSR, vitest, playwright). Each MUST have a
335+
corresponding ToolSet entry in the tool registry with appropriate lint, typecheck,
336+
test, security, build, and format tools. Each MUST appear in _TYPE_LABELS with a
337+
human-readable label.
338+
source: ARCHITECTURE.md §Implemented Specsmith System
339+
status: implemented

docs/tests/overflow.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -380,3 +380,49 @@
380380
input: YAML req with platform='linux', boundary='OS', confidence='0.9'; run_sync; inspect JSON
381381
expected_behavior: JSON entry has platform, boundary, confidence keys; absent fields not present
382382
confidence: 0.9
383+
- id: TEST-351
384+
title: specsmith checkpoint Emits GOVERNANCE ANCHOR with Required Fields
385+
description: >-
386+
specsmith checkpoint --json on a project with scaffold.yml MUST exit 0 and return
387+
JSON containing ts (ISO-8601), project (string), phase (string), phase_label,
388+
phase_pct (int), health (string), audit_failed (int), req_count (int), test_count (int),
389+
esdb_records (int), esdb_chain_valid (bool), recent_wis (list), last_preflight (string),
390+
and anchor ('SPECSMITH-ANCHOR-' prefix). Without --json it MUST print a line containing
391+
'GOVERNANCE ANCHOR'. Both forms MUST exit 0 on a project with no ESDB or LEDGER
392+
(best-effort, never throws).
393+
requirement_id: REQ-351
394+
type: cli
395+
verification_method: pytest
396+
input: specsmith checkpoint --json --project-dir tmp; specsmith checkpoint --project-dir tmp
397+
expected_behavior: JSON has all required fields; human output contains GOVERNANCE ANCHOR; exit 0 in both cases
398+
confidence: 0.95
399+
- id: TEST-352
400+
title: M006 Injects Session Governance Protocol into AGENTS.md
401+
description: >-
402+
SessionGovernanceMigration().run(tmp_path) on a project with AGENTS.md that lacks
403+
'specsmith checkpoint' MUST inject the Session Governance Protocol section, create
404+
.specsmith/agents.md.m006.bak, and return success=True with 'AGENTS.md' in
405+
files_modified. Re-running MUST be a no-op (idempotent). Running with dry_run=True
406+
MUST report what would change without writing. rollback() MUST restore AGENTS.md
407+
from the backup. M006 MUST appear in MigrationRegistry.all().
408+
requirement_id: REQ-352
409+
type: integration
410+
verification_method: pytest
411+
input: SessionGovernanceMigration().run(tmp_path); dry_run=True; rollback(); re-run after injection
412+
expected_behavior: Protocol injected; backup created; dry_run no writes; rollback restores; idempotent; registry includes v6
413+
confidence: 0.95
414+
- id: TEST-353
415+
title: Modern Web Framework Types Have Tool Registry Entries
416+
description: >-
417+
list_tools_for_type(ProjectType.NEXTJS_APP) MUST return a ToolSet with 'next build'
418+
in build and 'eslint' in lint. list_tools_for_type(ProjectType.NUXT_APP) MUST have
419+
'nuxt build' in build. list_tools_for_type(ProjectType.SVELTEKIT_APP) MUST have
420+
'vite build'. list_tools_for_type(ProjectType.REMIX_APP) MUST have 'remix vite:build'.
421+
list_tools_for_type(ProjectType.ASTRO_SITE) MUST have 'astro build'. All five types
422+
MUST appear in _TYPE_LABELS with non-empty human-readable labels.
423+
requirement_id: REQ-353
424+
type: unit
425+
verification_method: pytest
426+
input: list_tools_for_type for each new type; check _TYPE_LABELS
427+
expected_behavior: Each type has correct build tool; all five types in _TYPE_LABELS
428+
confidence: 0.95

0 commit comments

Comments
 (0)