mdkg 0.4.2 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/CHANGELOG.md +88 -15
  2. package/CLI_COMMAND_MATRIX.md +74 -5
  3. package/README.md +30 -2
  4. package/dist/cli.js +132 -5
  5. package/dist/command-contract.json +778 -16
  6. package/dist/commands/archive.js +196 -42
  7. package/dist/commands/bundle.js +180 -44
  8. package/dist/commands/capability.js +1 -0
  9. package/dist/commands/checkpoint.js +6 -5
  10. package/dist/commands/event_support.js +16 -7
  11. package/dist/commands/fix.js +11 -8
  12. package/dist/commands/git.js +41 -10
  13. package/dist/commands/goal.js +23 -23
  14. package/dist/commands/graph.js +64 -10
  15. package/dist/commands/handoff.js +4 -2
  16. package/dist/commands/init.js +28 -23
  17. package/dist/commands/loop.js +1668 -0
  18. package/dist/commands/loop_descriptors.js +219 -0
  19. package/dist/commands/mcp.js +101 -11
  20. package/dist/commands/new.js +49 -3
  21. package/dist/commands/pack.js +14 -7
  22. package/dist/commands/search.js +10 -1
  23. package/dist/commands/skill.js +12 -9
  24. package/dist/commands/skill_mirror.js +39 -31
  25. package/dist/commands/subgraph.js +59 -26
  26. package/dist/commands/task.js +77 -4
  27. package/dist/commands/upgrade.js +13 -15
  28. package/dist/commands/validate.js +20 -7
  29. package/dist/commands/work.js +44 -26
  30. package/dist/commands/workspace.js +10 -4
  31. package/dist/core/config.js +45 -17
  32. package/dist/core/filesystem_authority.js +281 -0
  33. package/dist/core/project_db_events.js +4 -0
  34. package/dist/core/project_db_materializer.js +2 -0
  35. package/dist/core/project_db_migrations.js +238 -181
  36. package/dist/core/project_db_snapshot.js +64 -14
  37. package/dist/core/workspace_path.js +7 -0
  38. package/dist/graph/archive_integrity.js +1 -1
  39. package/dist/graph/capabilities_index_cache.js +4 -1
  40. package/dist/graph/frontmatter.js +38 -0
  41. package/dist/graph/goal_scope.js +4 -1
  42. package/dist/graph/index_cache.js +37 -7
  43. package/dist/graph/loop_bindings.js +39 -0
  44. package/dist/graph/node.js +209 -1
  45. package/dist/graph/node_body.js +52 -6
  46. package/dist/graph/skills_index_cache.js +41 -6
  47. package/dist/graph/skills_indexer.js +5 -2
  48. package/dist/graph/sqlite_index.js +118 -105
  49. package/dist/graph/subgraphs.js +142 -5
  50. package/dist/graph/validate_graph.js +109 -13
  51. package/dist/graph/workspace_files.js +39 -9
  52. package/dist/init/AGENT_START.md +16 -0
  53. package/dist/init/CLI_COMMAND_MATRIX.md +14 -0
  54. package/dist/init/config.json +7 -1
  55. package/dist/init/init-manifest.json +49 -4
  56. package/dist/init/skills/default/pursue-mdkg-loop/SKILL.md +150 -0
  57. package/dist/init/templates/default/loop.md +160 -0
  58. package/dist/init/templates/loops/backend-api-cli-bloat-audit.loop.md +117 -0
  59. package/dist/init/templates/loops/design-frontend-ux-audit.loop.md +117 -0
  60. package/dist/init/templates/loops/duplicate-code-and-linting-audit.loop.md +114 -0
  61. package/dist/init/templates/loops/security-audit.loop.md +140 -0
  62. package/dist/init/templates/loops/tech-stack-best-practices-audit.loop.md +116 -0
  63. package/dist/init/templates/loops/test-ci-skill-infrastructure-audit.loop.md +116 -0
  64. package/dist/init/templates/loops/user-story-audit-and-recommendations.loop.md +116 -0
  65. package/dist/pack/order.js +3 -1
  66. package/dist/pack/pack.js +139 -6
  67. package/dist/templates/loader.js +9 -3
  68. package/dist/util/lock.js +10 -9
  69. package/dist/util/zip.js +163 -9
  70. package/package.json +8 -4
@@ -0,0 +1,140 @@
1
+ ---
2
+ id: loop-1
3
+ type: loop
4
+ title: Security Audit
5
+ status: todo
6
+ priority: 1
7
+ loop_mode: readonly
8
+ loop_role: template
9
+ scope_refs: []
10
+ scope_description: Repository or package scope selected for a read-only security audit.
11
+ template_refs: []
12
+ materialization_mode: default_children
13
+ child_refs: []
14
+ pre_run_questions: [external_advisory_checks_approved, security_provider_workflow_approved, local_cache_writes_approved, audit_scope]
15
+ question_answer_refs: []
16
+ pre_approved_actions: [read_source, inspect_lockfiles, run_local_static_scans, create_mdkg_evidence]
17
+ approval_gated_actions: [external_advisory_checks, security_provider_workflow]
18
+ required_actions: [read_source, inspect_lockfiles, run_local_static_scans, create_mdkg_evidence]
19
+ requested_actions: [read_source, inspect_lockfiles, run_local_static_scans, create_mdkg_evidence]
20
+ prohibited_actions: [functional_changes, push_publish_deploy]
21
+ action_approval_refs: []
22
+ evidence_lanes: [source_security_review, credential_secret_exposure, dependency_advisories, public_exposure, package_export_surfaces, finding_triage]
23
+ evidence_lane_refs: []
24
+ lane_waiver_refs: []
25
+ lane_waiver_decision_refs: []
26
+ lane_waiver_approval_refs: []
27
+ run_refs: []
28
+ decision_refs: []
29
+ output_refs: []
30
+ approval_refs: []
31
+ evaluation_refs: []
32
+ definition_of_done: Security audit required lanes are complete or explicitly waived; residual follow-up is classified separately from definition-blocking gaps.
33
+ blocker_policy: spike_proposal_recommendation_continue
34
+ tags: [loop-template, audit, security]
35
+ owners: []
36
+ links: []
37
+ artifacts: []
38
+ relates: []
39
+ blocked_by: []
40
+ blocks: []
41
+ refs: []
42
+ context_refs: []
43
+ evidence_refs: []
44
+ aliases: [security-audit-loop]
45
+ skills: [pursue-mdkg-loop]
46
+ created: 2026-07-06
47
+ updated: 2026-07-06
48
+ ---
49
+
50
+ # Operating Model
51
+
52
+ Run a read-only security review over the selected scope. Ground findings in source, configuration, dependency metadata, generated artifacts, and existing mdkg context. Do not make code changes from this loop.
53
+
54
+ # Default Child Nodes
55
+
56
+ - Spike for threat model and attack surface discovery.
57
+ - Task or test nodes for validated remediation work.
58
+ - Checkpoint for scan evidence and residual risk.
59
+
60
+ # Definition Of Done
61
+
62
+ - Source/security-sensitive code is reviewed with source-grounded evidence.
63
+ - Credential and secret exposure checks are run or explicitly waived.
64
+ - Dependency advisory checks cover all publish-relevant packages or are
65
+ explicitly waived.
66
+ - Public/docs/demo exposure surfaces are reviewed when in scope.
67
+ - Package, bundle, archive, subgraph, and publish surfaces are reviewed when in
68
+ scope.
69
+ - Valid findings include affected files, impact, evidence, severity, and
70
+ remediation direction.
71
+ - False positives, residual uncertainty, and non-blocking hardening work are
72
+ recorded.
73
+ - Required lanes are complete or linked to accepted `decision_refs` or
74
+ `approval_refs`.
75
+
76
+ # Required Evidence Lanes
77
+
78
+ | Lane | Required | Evidence Needed | Status | Blocker | Recovery Node | Decision Or Waiver |
79
+ | --- | --- | --- | --- | --- | --- | --- |
80
+ | source security review | yes | files and source-grounded findings | todo | none | none | none |
81
+ | credential/secret exposure | yes | local scan plus manual review notes | todo | none | none | none |
82
+ | dependency advisories | yes | root and subpackage advisory receipts | todo | external registry approval may be needed | proposal or approval request | none |
83
+ | public/docs/demo exposure | scope-dependent | reviewed public surfaces and claims | todo | none | none | none |
84
+ | package/bundle/archive/subgraph surfaces | scope-dependent | package and graph export review | todo | none | none | none |
85
+ | finding triage | yes | severity, impact, evidence, recommendation | todo | none | none | none |
86
+
87
+ # Pre-Run Questions
88
+
89
+ - Are external advisory checks such as `npm audit` approved for every package
90
+ that may send dependency metadata to a registry?
91
+ - Is Codex Security or another multi-agent/security provider workflow approved?
92
+ - Are local test/build commands approved when they write caches or generated
93
+ outputs outside committed source?
94
+ - Is the audit pre-publish, local-only, or scoped to a smaller package/folder?
95
+
96
+ # Pre-Approved Read-Only Actions
97
+
98
+ - Read source, docs, mdkg graph, package metadata, lockfiles, configs, tests,
99
+ generated public surfaces, and local scripts.
100
+ - Run local static scans, `rg`, `mdkg show/search/pack/validate`, local tests,
101
+ local builds, and package inspection commands that do not call external
102
+ services.
103
+ - Create mdkg evidence, findings, spikes, proposals, tasks, tests, checkpoints,
104
+ and open questions.
105
+ - Make provisional severity and priority calls for later human/orchestrator
106
+ review.
107
+
108
+ # Approval-Gated Actions
109
+
110
+ - External registry/advisory/security-provider calls.
111
+ - Multi-agent delegation or privileged security tooling.
112
+ - Functional source, docs, template, generated command, or runtime changes.
113
+ - Push, publish, tag, deploy, DNS, analytics, or provider-side actions.
114
+
115
+ # Blocker Continuation
116
+
117
+ If a lane is blocked by missing credentials, private systems, external approval,
118
+ or unavailable runtime state, write blocker evidence, create or update a spike
119
+ and proposal with at least three viable paths, recommend one path, and continue
120
+ every other authorized audit lane.
121
+
122
+ Do not mark the whole loop blocked while any required or useful security audit
123
+ lane remains actionable. Do not mark the loop done when a required lane is only
124
+ represented as future work; it must be completed or explicitly waived.
125
+
126
+ # Closeout Matrix
127
+
128
+ Before closeout, update the required evidence lane table and classify every
129
+ follow-up as one of:
130
+
131
+ - definition-blocking: loop remains open until completed or waived;
132
+ - residual hardening: follow-up can remain after loop closeout;
133
+ - false positive: no action required, with evidence;
134
+ - accepted waiver: linked through `decision_refs` or `approval_refs`.
135
+
136
+ # Provisional Decisions And Open Questions
137
+
138
+ Record security severity calls, waiver candidates, approval requests, and
139
+ external-check questions here or in linked proposal/decision nodes before
140
+ treating them as accepted.
@@ -0,0 +1,116 @@
1
+ ---
2
+ id: loop-4
3
+ type: loop
4
+ title: Tech Stack Best Practices Audit
5
+ status: todo
6
+ priority: 1
7
+ loop_mode: readonly
8
+ loop_role: template
9
+ scope_refs: []
10
+ scope_description: Repository package or subsystem selected for stack-specific best-practices review.
11
+ template_refs: []
12
+ materialization_mode: default_children
13
+ child_refs: []
14
+ pre_run_questions: [target_stack, external_docs_allowed, local_tests_approved, compatibility_priority]
15
+ question_answer_refs: []
16
+ pre_approved_actions: [read_source, inspect_dependencies, run_local_checks, create_mdkg_evidence]
17
+ approval_gated_actions: [external_docs_search]
18
+ required_actions: [read_source, inspect_dependencies, run_local_checks, create_mdkg_evidence]
19
+ requested_actions: [read_source, inspect_dependencies, run_local_checks, create_mdkg_evidence]
20
+ prohibited_actions: [dependency_upgrades, architecture_changes, push_publish_deploy]
21
+ action_approval_refs: []
22
+ evidence_lanes: [stack_inventory, best_practice_gap_review, dependency_posture, compatibility_risk, recommendations]
23
+ evidence_lane_refs: []
24
+ lane_waiver_refs: []
25
+ lane_waiver_decision_refs: []
26
+ lane_waiver_approval_refs: []
27
+ run_refs: []
28
+ decision_refs: []
29
+ output_refs: []
30
+ approval_refs: []
31
+ evaluation_refs: []
32
+ definition_of_done: Stack-specific risks and improvement lanes are reviewed or explicitly waived against current project conventions.
33
+ blocker_policy: spike_proposal_recommendation_continue
34
+ tags: [loop-template, audit, best-practices, stack]
35
+ owners: []
36
+ links: []
37
+ artifacts: []
38
+ relates: []
39
+ blocked_by: []
40
+ blocks: []
41
+ refs: []
42
+ context_refs: []
43
+ evidence_refs: []
44
+ aliases: [tech-stack-audit-loop]
45
+ skills: [pursue-mdkg-loop]
46
+ created: 2026-07-06
47
+ updated: 2026-07-06
48
+ ---
49
+
50
+ # Operating Model
51
+
52
+ Run a read-only audit against the technology stack in the selected scope. Prefer official docs, local conventions, package metadata, and existing tests over generic advice.
53
+
54
+ # Default Child Nodes
55
+
56
+ - Spike for stack inventory and version-sensitive guidance.
57
+ - Test nodes for verification gaps.
58
+ - Proposal node for prioritized modernization or hardening paths.
59
+
60
+ # Definition Of Done
61
+
62
+ - Stack versions, frameworks, and local conventions are identified.
63
+ - Findings distinguish best-practice drift from acceptable project choices.
64
+ - Package metadata, config, official guidance availability, local tests, and
65
+ upgrade/deprecation risks are reviewed or explicitly waived.
66
+ - Recommendations are scoped and evidence-backed.
67
+ - Follow-up work is classified as definition-blocking or residual.
68
+
69
+ # Required Evidence Lanes
70
+
71
+ | Lane | Required | Evidence Needed | Status | Blocker | Recovery Node | Decision Or Waiver |
72
+ | --- | --- | --- | --- | --- | --- | --- |
73
+ | stack inventory | yes | package/config/framework versions | todo | none | none | none |
74
+ | local convention review | yes | source/docs/test convention evidence | todo | none | none | none |
75
+ | official guidance check | scope-dependent | current official docs or waived external lookup | todo | network may need approval | spike/proposal | none |
76
+ | package/deprecation risk | yes | local metadata and advisory/guidance notes | todo | external lookup may need approval | spike/proposal | none |
77
+ | test/build fit | yes | local command receipts or rationale | todo | tool failure may occur | spike/proposal | none |
78
+ | recommendations | yes | scoped risk/payoff notes | todo | none | none | none |
79
+
80
+ # Pre-Run Questions
81
+
82
+ - Which stack surfaces are in scope?
83
+ - Are official documentation lookups or external advisory calls approved?
84
+ - Are local tests/builds approved when they write caches or generated outputs?
85
+ - Should recommendations optimize for stability, modernization, performance, or
86
+ maintenance cost?
87
+
88
+ # Pre-Approved Read-Only Actions
89
+
90
+ - Inspect source, package metadata, lockfiles, configs, tests, docs, and mdkg
91
+ graph.
92
+ - Run local tests/builds, static discovery, version commands, and mdkg commands
93
+ that do not call external services.
94
+ - Create mdkg findings, proposals, tasks, tests, and open questions.
95
+
96
+ # Approval-Gated Actions
97
+
98
+ - External official-doc/advisory calls when they disclose project metadata.
99
+ - Dependency upgrades, config changes, generated updates, or functional source
100
+ edits.
101
+
102
+ # Blocker Continuation
103
+
104
+ If current external guidance or environment access is unavailable, create a
105
+ spike with source-grounded assumptions, propose at least three options,
106
+ recommend one path, and continue package/config/source/test review.
107
+
108
+ Do not mark the whole loop blocked while another stack lane remains actionable.
109
+ Do not close the loop until required lanes are complete or linked to accepted
110
+ `decision_refs` or `approval_refs`.
111
+
112
+ # Closeout Matrix
113
+
114
+ Classify follow-up work as definition-blocking evidence, residual stack
115
+ improvement, accepted waiver, or false positive before marking the loop done or
116
+ blocked.
@@ -0,0 +1,116 @@
1
+ ---
2
+ id: loop-6
3
+ type: loop
4
+ title: Test CI Skill Infrastructure Audit
5
+ status: todo
6
+ priority: 1
7
+ loop_mode: readonly
8
+ loop_role: template
9
+ scope_refs: []
10
+ scope_description: Repository or workspace selected for tests CI automation and SKILL.md infrastructure audit.
11
+ template_refs: []
12
+ materialization_mode: default_children
13
+ child_refs: []
14
+ pre_run_questions: [target_scope, local_ci_simulation_approved, skill_sync_allowed, generated_output_policy]
15
+ question_answer_refs: []
16
+ pre_approved_actions: [read_tests, inspect_ci_config, run_local_smokes, create_mdkg_evidence]
17
+ approval_gated_actions: [external_ci_calls]
18
+ required_actions: [read_tests, inspect_ci_config, run_local_smokes, create_mdkg_evidence]
19
+ requested_actions: [read_tests, inspect_ci_config, run_local_smokes, create_mdkg_evidence]
20
+ prohibited_actions: [ci_config_changes, skill_file_edits, push_publish_deploy]
21
+ action_approval_refs: []
22
+ evidence_lanes: [test_inventory, ci_gate_review, skill_infrastructure_review, gap_prioritization, recommendations]
23
+ evidence_lane_refs: []
24
+ lane_waiver_refs: []
25
+ lane_waiver_decision_refs: []
26
+ lane_waiver_approval_refs: []
27
+ run_refs: []
28
+ decision_refs: []
29
+ output_refs: []
30
+ approval_refs: []
31
+ evaluation_refs: []
32
+ definition_of_done: Test, CI, automation, and SKILL.md infrastructure lanes are reviewed or explicitly waived with prioritized improvements.
33
+ blocker_policy: spike_proposal_recommendation_continue
34
+ tags: [loop-template, audit, tests, ci, skills]
35
+ owners: []
36
+ links: []
37
+ artifacts: []
38
+ relates: []
39
+ blocked_by: []
40
+ blocks: []
41
+ refs: []
42
+ context_refs: []
43
+ evidence_refs: []
44
+ aliases: [test-ci-skill-audit-loop]
45
+ skills: [pursue-mdkg-loop]
46
+ created: 2026-07-06
47
+ updated: 2026-07-06
48
+ ---
49
+
50
+ # Operating Model
51
+
52
+ Run a read-only audit of tests, CI gates, automation scripts, and SKILL.md infrastructure. Look for brittle coverage, slow or missing gates, duplicate skill guidance, and reusable workflow gaps.
53
+
54
+ # Default Child Nodes
55
+
56
+ - Spike for test and CI inventory.
57
+ - Test nodes for missing coverage or smoke gates.
58
+ - Proposal node for skill consolidation and automation improvements.
59
+
60
+ # Definition Of Done
61
+
62
+ - Current local and CI verification surfaces are inventoried.
63
+ - Missing or weak gates are tied to user-facing or maintenance risk.
64
+ - SKILL.md duplication and consolidation opportunities are identified.
65
+ - Local smoke/unit/build commands, CI configuration, skill registry/mirrors, and
66
+ harness guidance are reviewed or explicitly waived.
67
+ - Follow-up work is classified as definition-blocking or residual.
68
+
69
+ # Required Evidence Lanes
70
+
71
+ | Lane | Required | Evidence Needed | Status | Blocker | Recovery Node | Decision Or Waiver |
72
+ | --- | --- | --- | --- | --- | --- | --- |
73
+ | local test/build inventory | yes | package scripts and command receipts | todo | tool failure may occur | spike/proposal | none |
74
+ | CI gate inventory | yes | workflow/config/provider evidence | todo | provider access may need approval | spike/proposal | none |
75
+ | smoke coverage | yes | smoke scripts and gaps | todo | none | none | none |
76
+ | SKILL.md registry and mirrors | yes | canonical and mirrored skill review | todo | none | none | none |
77
+ | harness guidance gaps | yes | missing/duplicated instructions | todo | none | none | none |
78
+ | prioritized improvements | yes | risk/payoff ordering | todo | none | none | none |
79
+
80
+ # Pre-Run Questions
81
+
82
+ - Is CI provider access approved, or should the audit stay local-only?
83
+ - Are local tests/builds approved when they write caches or generated outputs?
84
+ - Should skill changes be in scope, or should this audit only create proposals?
85
+ - Which runtime/client mirrors must be considered authoritative projections?
86
+
87
+ # Pre-Approved Read-Only Actions
88
+
89
+ - Inspect package scripts, tests, CI configs, smoke scripts, skills, mirrors,
90
+ generated docs, and mdkg graph.
91
+ - Run local tests/builds/smokes and mdkg validation commands that do not call
92
+ external services.
93
+ - Create mdkg evidence, skill-improvement proposals, tasks, tests, and open
94
+ questions.
95
+
96
+ # Approval-Gated Actions
97
+
98
+ - CI provider/API calls.
99
+ - Skill edits, mirror sync, source/test changes, generated updates, or
100
+ dependency changes unless the loop scope explicitly allows implementation.
101
+
102
+ # Blocker Continuation
103
+
104
+ If CI provider access or external logs are unavailable, create a spike, propose
105
+ at least three ways to obtain evidence, recommend one path, record blocker
106
+ evidence, and continue local test, smoke, script, and skill review.
107
+
108
+ Do not mark the whole loop blocked while another test/CI/skill lane remains
109
+ actionable. Do not close the loop until required lanes are complete or linked to
110
+ accepted `decision_refs` or `approval_refs`.
111
+
112
+ # Closeout Matrix
113
+
114
+ Classify follow-up work as definition-blocking gate evidence, residual
115
+ automation improvement, accepted waiver, or false positive before marking the
116
+ loop done or blocked.
@@ -0,0 +1,116 @@
1
+ ---
2
+ id: loop-7
3
+ type: loop
4
+ title: User Story Audit And Recommendations
5
+ status: todo
6
+ priority: 1
7
+ loop_mode: planning
8
+ loop_role: template
9
+ scope_refs: []
10
+ scope_description: Product area feature set or repository selected for user story audit and recommendations.
11
+ template_refs: []
12
+ materialization_mode: default_children
13
+ child_refs: []
14
+ pre_run_questions: [target_audience, product_surface, evidence_sources, recommendation_scope]
15
+ question_answer_refs: []
16
+ pre_approved_actions: [read_docs, inspect_existing_stories, review_mdkg_graph, create_mdkg_evidence]
17
+ approval_gated_actions: [external_research_calls]
18
+ required_actions: [read_docs, inspect_existing_stories, review_mdkg_graph, create_mdkg_evidence]
19
+ requested_actions: [read_docs, inspect_existing_stories, review_mdkg_graph, create_mdkg_evidence]
20
+ prohibited_actions: [public_copy_changes, roadmap_reprioritization, push_publish_deploy]
21
+ action_approval_refs: []
22
+ evidence_lanes: [story_inventory, persona_alignment, gap_analysis, recommendation_options, followup_work]
23
+ evidence_lane_refs: []
24
+ lane_waiver_refs: []
25
+ lane_waiver_decision_refs: []
26
+ lane_waiver_approval_refs: []
27
+ run_refs: []
28
+ decision_refs: []
29
+ output_refs: []
30
+ approval_refs: []
31
+ evaluation_refs: []
32
+ definition_of_done: User story and product outcome lanes are reviewed or explicitly waived with actionable recommendations.
33
+ blocker_policy: spike_proposal_recommendation_continue
34
+ tags: [loop-template, audit, planning, user-stories]
35
+ owners: []
36
+ links: []
37
+ artifacts: []
38
+ relates: []
39
+ blocked_by: []
40
+ blocks: []
41
+ refs: []
42
+ context_refs: []
43
+ evidence_refs: []
44
+ aliases: [user-story-audit-loop]
45
+ skills: [pursue-mdkg-loop]
46
+ created: 2026-07-06
47
+ updated: 2026-07-06
48
+ ---
49
+
50
+ # Operating Model
51
+
52
+ Run a planning-oriented audit of user stories, product flows, acceptance criteria, and unresolved requirements. Prefer existing docs, source behavior, tests, issue references, and current mdkg decisions.
53
+
54
+ # Default Child Nodes
55
+
56
+ - Spike for story and flow inventory.
57
+ - Proposal node with at least three viable product or implementation paths where gaps exist.
58
+ - Task or test nodes for accepted story improvements.
59
+
60
+ # Definition Of Done
61
+
62
+ - Existing user stories and implied product outcomes are mapped.
63
+ - Missing personas, edge cases, acceptance criteria, and risks are documented.
64
+ - Source/docs behavior, known decisions, open questions, and recommendation
65
+ tradeoffs are reviewed or explicitly waived.
66
+ - Recommendations are ordered by user value and implementation leverage.
67
+ - Follow-up work is classified as definition-blocking or residual.
68
+
69
+ # Required Evidence Lanes
70
+
71
+ | Lane | Required | Evidence Needed | Status | Blocker | Recovery Node | Decision Or Waiver |
72
+ | --- | --- | --- | --- | --- | --- | --- |
73
+ | story/outcome inventory | yes | stories, docs, goals, source behavior | todo | none | none | none |
74
+ | persona and journey gaps | yes | missing actors/flows/risk notes | todo | product context may be missing | spike/proposal | none |
75
+ | acceptance criteria | yes | criteria gaps and testability notes | todo | none | none | none |
76
+ | edge cases and failure modes | yes | grounded edge-case list | todo | none | none | none |
77
+ | decision/open-question mapping | yes | linked decisions/proposals/questions | todo | product approval may be needed | proposal | none |
78
+ | prioritized recommendations | yes | value/leverage/risk ordering | todo | none | none | none |
79
+
80
+ # Pre-Run Questions
81
+
82
+ - Which product area, user journey, or repo scope is in scope?
83
+ - Are assumptions allowed when product context is missing, or should the loop
84
+ request decisions first?
85
+ - Are local tests/builds approved when they write caches or generated outputs?
86
+ - Should recommendations create implementation tasks, proposal nodes, or both?
87
+
88
+ # Pre-Approved Read-Only Actions
89
+
90
+ - Inspect docs, mdkg goals/decisions, source behavior, tests, issues captured in
91
+ the repo, and product notes.
92
+ - Run local tests/builds and mdkg commands that do not call external services.
93
+ - Create mdkg stories, proposals, tasks, tests, spikes, and open questions.
94
+ - Make provisional prioritization recommendations for human/orchestrator
95
+ approval.
96
+
97
+ # Approval-Gated Actions
98
+
99
+ - Product-scope changes, implementation changes, public copy changes, deploys,
100
+ analytics, provider calls, or external issue-tracker mutations.
101
+
102
+ # Blocker Continuation
103
+
104
+ If product context is missing, create a spike with grounded assumptions, propose
105
+ at least three viable paths, recommend one path, mark blocker evidence, and
106
+ continue source, docs, workflow, and acceptance-criteria review.
107
+
108
+ Do not mark the whole loop blocked while another story/product lane remains
109
+ actionable. Do not close the loop until required lanes are complete or linked to
110
+ accepted `decision_refs` or `approval_refs`.
111
+
112
+ # Closeout Matrix
113
+
114
+ Classify follow-up work as definition-blocking product decision, residual story
115
+ improvement, accepted waiver, or false positive before marking the loop done or
116
+ blocked.
@@ -17,14 +17,16 @@ const FALLBACK_TYPES = [
17
17
  "proposal",
18
18
  "archive",
19
19
  "goal",
20
+ "loop",
20
21
  "epic",
21
22
  "feat",
22
23
  "task",
23
24
  "bug",
24
25
  "spike",
25
26
  "checkpoint",
27
+ "test",
26
28
  ];
27
- const WORK_TYPES = ["goal", "epic", "feat", "task", "bug", "spike", "checkpoint"];
29
+ const WORK_TYPES = ["goal", "loop", "epic", "feat", "task", "bug", "spike", "checkpoint", "test"];
28
30
  function idNumber(id) {
29
31
  const match = id.match(/-(\d+)$/);
30
32
  if (!match) {