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,150 @@
1
+ ---
2
+ name: pursue-mdkg-loop
3
+ description: Pursue a selected mdkg loop by exhausting authorized linked work lanes, recording blocker recovery, and closing only when the loop definition of done is satisfied or explicitly waived.
4
+ tags: [stage:execute, writer:orchestrator, mdkg, loop, recursive]
5
+ version: 0.2.0
6
+ authors: [mdkg]
7
+ links: [AGENT_START.md, CLI_COMMAND_MATRIX.md]
8
+ ---
9
+
10
+ # Goal
11
+
12
+ Move one durable mdkg loop forward without prematurely closing, blocking, or
13
+ shrinking the loop definition of done.
14
+
15
+ ## When To Use
16
+
17
+ - A user has selected or named a `type: loop` node.
18
+ - A reusable audit, planning, or implementation process should work across
19
+ several linked goals, tasks, tests, spikes, proposals, checkpoints, or
20
+ decisions.
21
+ - A loop should keep making progress after one branch hits a decision point.
22
+
23
+ ## Inputs
24
+
25
+ - Repo root
26
+ - Loop id, qid, or template alias
27
+ - Loop node, required evidence lanes, child refs, linked goals, output refs,
28
+ decision refs, approval refs, and blocker policy
29
+ - Current user constraints, available approvals, and stop conditions
30
+
31
+ ## Steps
32
+
33
+ 1. Resolve the loop with `mdkg loop show <loop> --json`.
34
+ 2. Inspect identity-scoped readiness with `mdkg loop plan <loop> --json`.
35
+ 3. Route with `mdkg loop next <loop> --json`; prefer its authorized child or
36
+ recovery selection unless current graph evidence justifies an override.
37
+ 4. Build context with `mdkg pack <loop> --pack-profile concise --dry-run --stats`.
38
+ 5. Build a completion matrix: lane, required/optional, linked refs, allowed
39
+ actions, needed evidence, status, blockers, recovery node, and accepted
40
+ decision or waiver.
41
+ 6. Surface pre-run questions before beginning when the loop template declares
42
+ external calls, privileged tools, multi-agent delegation, publish, deploy,
43
+ provider, or policy-sensitive decisions.
44
+ 7. Treat read-only and planning loops as pre-approved for low-risk local work:
45
+ source/doc/mdkg inspection, local discovery commands, local tests/builds that
46
+ may write caches or generated outputs outside committed source, mdkg evidence
47
+ nodes, and provisional triage.
48
+ 8. Do not treat read-only/planning preapproval as permission for functional
49
+ source changes, push/publish/tag/deploy, external metadata-disclosing calls,
50
+ privileged tools, or subagent delegation unless approval is explicit.
51
+ 9. Work the linked graph, not just the first branch. If one branch is blocked,
52
+ record blocker recovery and continue another authorized branch.
53
+ 10. Classify blockers as `recoverable_now`, `branch_blocked`,
54
+ `definition_blocking`, or `residual`.
55
+ 11. For non-trivial blockers, create or update a source-grounded spike, proposal
56
+ or open-question section with at least three viable paths, one recommended
57
+ path, and blocker evidence.
58
+ 12. Continue while any authorized, in-scope, linked work remains actionable.
59
+ 13. Bind answers, approvals, evidence, and waivers to stable identities with
60
+ `question_answer_refs`, `action_approval_refs`, `evidence_lane_refs`,
61
+ `lane_waiver_decision_refs`, and `lane_waiver_approval_refs`. A waiver
62
+ requires both an accepted decision and verified approval for the same lane.
63
+ 14. Mark the loop done only when every required lane is complete or explicitly
64
+ waived and the loop body explains why the definition of done is satisfied.
65
+ 15. Mark the loop blocked only when no authorized, useful, in-scope linked work
66
+ remains across the loop graph and the loop records required decisions,
67
+ follow-up work, and unblock paths. Confirm
68
+ `exhaustion.whole_loop_blocked: true` from `mdkg loop next --json` against
69
+ current graph state before stopping.
70
+
71
+ ## Outputs
72
+
73
+ - Completion matrix for the loop
74
+ - Evidence recorded on linked children and summarized on the loop
75
+ - Provisional decisions, open questions, approval requests, and residual
76
+ follow-up work
77
+ - A clear stop reason: continue, done, blocked, or waiting for approval
78
+
79
+ ## Required Capabilities
80
+
81
+ - mdkg loop inspection and packing
82
+ - mdkg graph search/show/validate
83
+ - Source and documentation review
84
+ - Local command execution within the loop's authorization
85
+ - Proposal, decision, spike, task, test, and checkpoint authoring
86
+
87
+ ## Resources Touched
88
+
89
+ - `.mdkg/work/<loop>.md`
90
+ - Linked child nodes under `.mdkg/work/`
91
+ - Linked design and decision docs under `.mdkg/design/`
92
+ - Local source/docs/test files only for read-only inspection unless the loop is
93
+ explicitly write-capable
94
+
95
+ ## Validation Checks
96
+
97
+ - `git status --short --branch`
98
+ - `mdkg loop show <loop> --json`
99
+ - `mdkg loop plan <loop> --json`
100
+ - `mdkg loop next <loop> --json`
101
+ - `mdkg pack <loop> --pack-profile concise --dry-run --stats`
102
+ - `mdkg validate --changed-only --json`
103
+ - `mdkg validate --summary --json --limit 20`
104
+ - Loop-specific local checks from the template or linked child nodes
105
+
106
+ ## Closeout Evidence
107
+
108
+ - Completion matrix with every required lane classified
109
+ - Evidence refs for completed lanes
110
+ - Decision refs or approval refs for accepted waivers
111
+ - Follow-up nodes split into definition-blocking and residual work
112
+ - Validation receipts
113
+ - A loop summary that states why the loop is done, blocked, or continuing
114
+
115
+ ## Safety
116
+
117
+ - Do not mark a loop done merely because follow-up nodes were created.
118
+ - Do not mark a loop blocked while authorized linked work remains actionable.
119
+ - Do not shrink the loop definition of done without a durable decision or
120
+ approval record.
121
+ - Treat external advisory checks, provider calls, publish/deploy actions, and
122
+ multi-agent delegation as approval-gated unless the loop has explicit
123
+ pre-approval.
124
+ - Communicate provisional decisions and open questions to the human or
125
+ higher-level orchestrator before treating them as accepted.
126
+
127
+ ## Failure Handling
128
+
129
+ - If pre-run approvals are missing, record the decision request and continue
130
+ authorized local lanes.
131
+ - If all branches are blocked, create or update spike/proposal/decision-request
132
+ nodes before marking the loop blocked.
133
+ - If validation fails, keep the loop open and record the failing lane.
134
+ - If the loop template lacks required evidence lanes, create a template
135
+ hardening task instead of silently closing the loop.
136
+
137
+ ## Related Manifests
138
+
139
+ - Future loop-runner or orchestrator agent manifests.
140
+
141
+ ## Projection Targets
142
+
143
+ - `.agents/skills/pursue-mdkg-loop`
144
+ - `.claude/skills/pursue-mdkg-loop`
145
+ - `assets/init/skills/default/pursue-mdkg-loop`
146
+
147
+ ## Open Questions
148
+
149
+ - Should mdkg add first-class approval nodes later, or keep approvals as typed
150
+ decision refs plus checkpoint, receipt, and external approval refs?
@@ -0,0 +1,160 @@
1
+ ---
2
+ id: {{id}}
3
+ type: loop
4
+ title: {{title}}
5
+ status: {{status}}
6
+ priority: {{priority}}
7
+ loop_mode: planning
8
+ loop_role: scoped
9
+ scope_refs: []
10
+ scope_description: Set the repo folder goal or project area this loop governs.
11
+ template_refs: []
12
+ materialization_mode: default_children
13
+ child_refs: []
14
+ pre_run_questions: [scope_authority, local_cache_writes_approved, external_calls_approved]
15
+ question_answer_refs: []
16
+ pre_approved_actions: [read_source, run_local_discovery, create_mdkg_evidence]
17
+ approval_gated_actions: [external_calls]
18
+ required_actions: [read_source, run_local_discovery, create_mdkg_evidence]
19
+ requested_actions: [read_source, run_local_discovery, create_mdkg_evidence]
20
+ prohibited_actions: [functional_changes, push_publish_deploy]
21
+ action_approval_refs: []
22
+ evidence_lanes: [required_evidence, blocker_recovery, closeout_matrix]
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: Loop required evidence lanes are complete or explicitly waived, and the closeout matrix records why the loop is done, blocked, or continuing.
33
+ blocker_policy: spike_proposal_recommendation_continue
34
+ epic: {{epic}}
35
+ parent: {{parent}}
36
+ prev: {{prev}}
37
+ next: {{next}}
38
+ tags: []
39
+ owners: []
40
+ links: []
41
+ artifacts: []
42
+ relates: []
43
+ blocked_by: []
44
+ blocks: []
45
+ refs: []
46
+ context_refs: []
47
+ evidence_refs: []
48
+ aliases: []
49
+ skills: [pursue-mdkg-loop]
50
+ created: {{created}}
51
+ updated: {{updated}}
52
+ ---
53
+
54
+ # Operating Model
55
+
56
+ Describe the reusable process this loop represents and the work it should coordinate.
57
+
58
+ # Scope
59
+
60
+ State the repository, folder, goal, or project area this loop applies to.
61
+
62
+ # Definition Of Done
63
+
64
+ Define the high bar this loop must reach before it can close. A loop must not
65
+ close merely because follow-up nodes were created.
66
+
67
+ # Required Evidence Lanes
68
+
69
+ List the lanes the loop must complete or explicitly waive.
70
+
71
+ | Lane | Required | Evidence Needed | Status | Blocker | Recovery Node | Decision Or Waiver |
72
+ | --- | --- | --- | --- | --- | --- | --- |
73
+ | example lane | yes | source-grounded evidence | todo | none | none | none |
74
+
75
+ # Pre-Run Questions
76
+
77
+ Ask these before execution when the loop needs configuration or approval.
78
+
79
+ - Which scope is authoritative for this run?
80
+ - Are external network, provider, registry, security, browser, or multi-agent
81
+ calls approved?
82
+ - Are local test/build commands approved when they write caches or generated
83
+ outputs outside committed source?
84
+
85
+ # Pre-Approved Read-Only Actions
86
+
87
+ - Read source, docs, mdkg graph, package metadata, configs, and tests.
88
+ - Run local discovery commands and local tests/builds when allowed by the loop
89
+ or user.
90
+ - Create mdkg evidence, spike, proposal, task, test, checkpoint, and
91
+ open-question nodes.
92
+ - Make provisional triage decisions and record them for human or orchestrator
93
+ approval.
94
+
95
+ # Approval-Gated Actions
96
+
97
+ - Functional source, docs, template, generated command, or runtime changes.
98
+ - Push, publish, tag, deploy, DNS, analytics, provider, or external registry
99
+ actions.
100
+ - External calls that disclose repository, package, dependency, user, or
101
+ provider metadata.
102
+ - Subagent or privileged tool delegation unless explicitly approved.
103
+
104
+ # Child Node Materialization
105
+
106
+ - Default child nodes to create immediately.
107
+ - Planning-only or no-child mode expectations.
108
+
109
+ # Template Lineage
110
+
111
+ - Template source.
112
+ - Forked scope.
113
+ - Local specialization.
114
+ - Reusable improvements to promote back.
115
+
116
+ # Run And Evidence Model
117
+
118
+ - Run records or event streams.
119
+ - Evidence, observations, findings, decisions, outputs, and receipts.
120
+
121
+ # Blocker Continuation Policy
122
+
123
+ When a branch is blocked, classify it as `recoverable_now`, `branch_blocked`,
124
+ `definition_blocking`, or `residual`.
125
+
126
+ - `recoverable_now`: request approval, use an approved local proof path, or run
127
+ an already authorized tool.
128
+ - `branch_blocked`: create or update a spike/proposal/options node, record
129
+ blocker evidence, and continue other linked work.
130
+ - `definition_blocking`: keep the loop open until the missing lane is completed
131
+ or explicitly waived.
132
+ - `residual`: create follow-up work, mark it non-blocking, and allow closeout
133
+ only if all required lanes are otherwise satisfied.
134
+
135
+ Whole-loop blocked state is allowed only when no authorized, useful, in-scope
136
+ linked work remains across the loop graph.
137
+
138
+ # Waiver And Decision Policy
139
+
140
+ - Use proposal or open-question nodes for candidate waivers.
141
+ - Use `decision_refs` for accepted design, product, or policy waivers.
142
+ - Use `approval_refs` for concrete human/orchestrator approval receipts,
143
+ artifacts, or future approval nodes.
144
+ - A simple body section is transitional MVP evidence only; prefer durable linked
145
+ nodes for long-lived waivers.
146
+
147
+ # Closeout Matrix
148
+
149
+ Before marking the loop done or blocked, update the required evidence lane table
150
+ and explain why each lane is complete, waived, residual, or blocking.
151
+
152
+ # Validation Plan
153
+
154
+ - Parser and template validation.
155
+ - Search, show, list, index, and pack visibility.
156
+ - Fork provenance and child materialization checks.
157
+
158
+ # Current State
159
+
160
+ - Not run yet.
@@ -0,0 +1,117 @@
1
+ ---
2
+ id: loop-3
3
+ type: loop
4
+ title: Backend API CLI Bloat Audit
5
+ status: todo
6
+ priority: 1
7
+ loop_mode: readonly
8
+ loop_role: template
9
+ scope_refs: []
10
+ scope_description: Backend service API or CLI surface selected for modularity and bloat review.
11
+ template_refs: []
12
+ materialization_mode: default_children
13
+ child_refs: []
14
+ pre_run_questions: [scope_surface, local_cache_writes_approved, external_compatibility_checks_approved, optimization_priority]
15
+ question_answer_refs: []
16
+ pre_approved_actions: [read_source, inspect_help_and_contracts, run_local_inventory, create_mdkg_evidence]
17
+ approval_gated_actions: [external_compatibility_checks, downstream_repo_checks]
18
+ required_actions: [read_source, inspect_help_and_contracts, run_local_inventory, create_mdkg_evidence]
19
+ requested_actions: [read_source, inspect_help_and_contracts, run_local_inventory, create_mdkg_evidence]
20
+ prohibited_actions: [functional_changes, push_publish_deploy]
21
+ action_approval_refs: []
22
+ evidence_lanes: [public_command_api_inventory, flag_option_sprawl, ownership_boundaries, duplicated_command_logic, compatibility_risk, simplification_proposals]
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: Backend API or CLI complexity lanes are reviewed or explicitly waived, and simplification recommendations are source-grounded.
33
+ blocker_policy: spike_proposal_recommendation_continue
34
+ tags: [loop-template, audit, backend, api, cli]
35
+ owners: []
36
+ links: []
37
+ artifacts: []
38
+ relates: []
39
+ blocked_by: []
40
+ blocks: []
41
+ refs: []
42
+ context_refs: []
43
+ evidence_refs: []
44
+ aliases: [backend-cli-bloat-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 for backend, API, and CLI design bloat. Look for sprawling flags, mixed ownership, duplicated command logic, weak module boundaries, and overly broad abstractions.
53
+
54
+ # Default Child Nodes
55
+
56
+ - Spike for command/API inventory.
57
+ - Proposal node for simplification paths.
58
+ - Task nodes for focused refactors that preserve behavior.
59
+
60
+ # Definition Of Done
61
+
62
+ - Public surfaces and core ownership boundaries are inventoried.
63
+ - Bloat or coupling risks are tied to concrete source locations.
64
+ - Command/API flag sprawl, mixed ownership, duplicate handlers, module
65
+ cohesion, and output/help consistency are reviewed or explicitly waived.
66
+ - Recommendations preserve compatibility unless explicitly accepted otherwise.
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
+ | public command/API inventory | yes | command/API list and source refs | todo | none | none | none |
74
+ | flag and option sprawl | yes | flagged commands/options with rationale | todo | none | none | none |
75
+ | ownership boundaries | yes | module/command boundary notes | todo | none | none | none |
76
+ | duplicated command logic | yes | repeated handlers or helpers | todo | none | none | none |
77
+ | compatibility risk | yes | behavior-preserving recommendations | todo | external behavior may need proof | spike/proposal | none |
78
+ | simplification proposals | yes | at least three paths for major changes | todo | none | none | none |
79
+
80
+ # Pre-Run Questions
81
+
82
+ - Which command, API, package, or backend surface is in scope?
83
+ - Are local tests/builds approved when they write caches or generated outputs?
84
+ - Are external compatibility checks, service calls, or downstream repo checks
85
+ approved?
86
+ - Should recommendations optimize for compatibility, simplicity, performance, or
87
+ public CLI ergonomics first?
88
+
89
+ # Pre-Approved Read-Only Actions
90
+
91
+ - Inspect source, command registration, help text, tests, docs, generated command
92
+ references, and package metadata.
93
+ - Run local CLI help, local tests/builds, `rg`, `mdkg show/search/pack/validate`,
94
+ and static command/API inventory scripts.
95
+ - Create mdkg spikes, proposals, tasks, tests, checkpoints, and open questions.
96
+
97
+ # Approval-Gated Actions
98
+
99
+ - Functional code, docs, template, generated command, or public CLI behavior
100
+ changes.
101
+ - External service calls or downstream compatibility checks.
102
+ - Push, publish, tag, deploy, or provider-side actions.
103
+
104
+ # Blocker Continuation
105
+
106
+ If external service behavior or compatibility impact cannot be proven, create a
107
+ spike, propose at least three viable paths, recommend one path, record blocker
108
+ evidence, and continue local source, docs, help, and test analysis.
109
+
110
+ Do not mark the whole loop blocked while another command/API lane remains
111
+ actionable. Do not close the loop until required lanes are complete or linked to
112
+ accepted `decision_refs` or `approval_refs`.
113
+
114
+ # Closeout Matrix
115
+
116
+ Classify follow-up work as compatibility-blocking, simplification residual,
117
+ accepted waiver, or false positive before marking the loop done or blocked.
@@ -0,0 +1,117 @@
1
+ ---
2
+ id: loop-2
3
+ type: loop
4
+ title: Design Frontend UX Audit
5
+ status: todo
6
+ priority: 1
7
+ loop_mode: readonly
8
+ loop_role: template
9
+ scope_refs: []
10
+ scope_description: Frontend application or user flow selected for design and UX audit.
11
+ template_refs: []
12
+ materialization_mode: default_children
13
+ child_refs: []
14
+ pre_run_questions: [target_surface, design_standard, browser_checks_approved, accessibility_priority]
15
+ question_answer_refs: []
16
+ pre_approved_actions: [read_source, inspect_design_tokens, capture_local_screenshots, create_mdkg_evidence]
17
+ approval_gated_actions: [external_design_tools]
18
+ required_actions: [read_source, inspect_design_tokens, capture_local_screenshots, create_mdkg_evidence]
19
+ requested_actions: [read_source, inspect_design_tokens, capture_local_screenshots, create_mdkg_evidence]
20
+ prohibited_actions: [visual_redesign_changes, deploy_preview_changes, push_publish_deploy]
21
+ action_approval_refs: []
22
+ evidence_lanes: [visual_consistency, accessibility_contrast, responsive_layout, interaction_ergonomics, design_system_fit, 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: UX and visual quality lanes are audited or explicitly waived against product design system and accessibility expectations.
33
+ blocker_policy: spike_proposal_recommendation_continue
34
+ tags: [loop-template, audit, design, ux, frontend]
35
+ owners: []
36
+ links: []
37
+ artifacts: []
38
+ relates: []
39
+ blocked_by: []
40
+ blocks: []
41
+ refs: []
42
+ context_refs: []
43
+ evidence_refs: []
44
+ aliases: [design-ux-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 design and frontend UX audit. Compare the current interface against the local design system, product intent, accessibility expectations, contrast, responsive behavior, and interaction polish.
53
+
54
+ # Default Child Nodes
55
+
56
+ - Spike for product/design context and screenshot inventory.
57
+ - Test nodes for accessibility, contrast, and responsive checks.
58
+ - Proposal node for prioritized UX improvements.
59
+
60
+ # Definition Of Done
61
+
62
+ - Screens or flows are inspected with evidence.
63
+ - Design-system drift, accessibility issues, and UX friction are identified.
64
+ - Contrast, responsive behavior, interaction states, copy clarity, and visual
65
+ hierarchy are reviewed or explicitly waived.
66
+ - Recommendations are prioritized by user impact and implementation risk.
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
+ | route/screen inventory | yes | screens, flows, or source routes | todo | none | none | none |
74
+ | design-system alignment | yes | local tokens/components/standards review | todo | none | none | none |
75
+ | accessibility and contrast | yes | local proof or code-level review | todo | visual runtime may be unavailable | spike/proposal | none |
76
+ | responsive behavior | yes | viewport proof or source-grounded review | todo | browser/runtime may be unavailable | spike/proposal | none |
77
+ | interaction states | scope-dependent | hover/focus/error/loading review | todo | none | none | none |
78
+ | prioritized recommendations | yes | user impact and risk ordering | todo | none | none | none |
79
+
80
+ # Pre-Run Questions
81
+
82
+ - Which routes, screens, or flows are in scope?
83
+ - Is browser/runtime proof approved or available?
84
+ - Are local builds/tests approved when they write caches or generated outputs?
85
+ - Should the audit optimize toward current local design, ChatGPT/Codex-inspired
86
+ interaction polish, accessibility, density, or conversion?
87
+
88
+ # Pre-Approved Read-Only Actions
89
+
90
+ - Inspect frontend source, design docs, tokens, CSS, components, screenshots,
91
+ generated static output, and local docs.
92
+ - Run local builds/tests, static accessibility checks, `rg`, mdkg commands, and
93
+ browser checks when available locally.
94
+ - Create mdkg findings, screenshots/artifact refs, proposals, tasks, tests, and
95
+ open questions.
96
+
97
+ # Approval-Gated Actions
98
+
99
+ - Functional UI/code/docs changes.
100
+ - External design tools, provider calls, deploys, analytics, or production
101
+ browser-session actions.
102
+
103
+ # Blocker Continuation
104
+
105
+ If visual runtime proof is blocked, write a spike with source-grounded options,
106
+ propose at least three ways to obtain evidence, recommend one path, mark blocker
107
+ evidence, and continue code-level design-system, accessibility, and interaction
108
+ analysis.
109
+
110
+ Do not mark the whole loop blocked while another UX lane remains actionable. Do
111
+ not close the loop until required lanes are complete or linked to accepted
112
+ `decision_refs` or `approval_refs`.
113
+
114
+ # Closeout Matrix
115
+
116
+ Classify follow-up work as definition-blocking UX evidence, residual polish,
117
+ accepted waiver, or false positive before marking the loop done or blocked.
@@ -0,0 +1,114 @@
1
+ ---
2
+ id: loop-5
3
+ type: loop
4
+ title: Duplicate Code And Linting Audit
5
+ status: todo
6
+ priority: 1
7
+ loop_mode: readonly
8
+ loop_role: template
9
+ scope_refs: []
10
+ scope_description: Repository package or folder selected for duplication lint and static-quality review.
11
+ template_refs: []
12
+ materialization_mode: default_children
13
+ child_refs: []
14
+ pre_run_questions: [target_scope, local_lint_checks_approved, generated_output_policy]
15
+ question_answer_refs: []
16
+ pre_approved_actions: [read_source, run_local_lint_inventory, inspect_duplicates, create_mdkg_evidence]
17
+ approval_gated_actions: []
18
+ required_actions: [read_source, run_local_lint_inventory, inspect_duplicates, create_mdkg_evidence]
19
+ requested_actions: [read_source, run_local_lint_inventory, inspect_duplicates, create_mdkg_evidence]
20
+ prohibited_actions: [automatic_refactors, formatter_rewrites, dependency_changes, push_publish_deploy]
21
+ action_approval_refs: []
22
+ evidence_lanes: [duplicate_code_inventory, linting_baseline, refactor_candidates, false_positive_triage, 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: Duplicate logic and static-quality lanes are reviewed or explicitly waived with practical follow-up recommendations.
33
+ blocker_policy: spike_proposal_recommendation_continue
34
+ tags: [loop-template, audit, duplicate-code, linting]
35
+ owners: []
36
+ links: []
37
+ artifacts: []
38
+ relates: []
39
+ blocked_by: []
40
+ blocks: []
41
+ refs: []
42
+ context_refs: []
43
+ evidence_refs: []
44
+ aliases: [duplicate-lint-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 duplication and linting audit. Use static analysis, existing linters, search, and source review to find repeated logic, inconsistent patterns, and preventable quality drift.
53
+
54
+ # Default Child Nodes
55
+
56
+ - Spike for duplicated pattern inventory.
57
+ - Test nodes for lint or static-analysis coverage.
58
+ - Task nodes for low-risk consolidation opportunities.
59
+
60
+ # Definition Of Done
61
+
62
+ - Duplicate or near-duplicate logic is identified with source evidence.
63
+ - Linting and formatting gaps are reviewed.
64
+ - Existing static-quality tools, repeated utility patterns, and avoidable
65
+ divergence are reviewed or explicitly waived.
66
+ - Recommendations avoid broad refactors without measurable payoff.
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
+ | duplicate logic search | yes | repeated functions/modules/source refs | todo | none | none | none |
74
+ | lint/format config review | yes | tool configs and current command behavior | todo | local tools may fail | spike/proposal | none |
75
+ | repeated utility patterns | yes | consolidation candidates and tradeoffs | todo | none | none | none |
76
+ | generated/vendor exclusions | yes | exclusion rationale | todo | none | none | none |
77
+ | recommendations | yes | scoped payoff/risk notes | todo | none | none | none |
78
+
79
+ # Pre-Run Questions
80
+
81
+ - Which folders or packages are in scope?
82
+ - Are local lint/test/build commands approved when they write caches or generated
83
+ outputs?
84
+ - Which generated, vendor, fixture, or snapshot folders should be excluded?
85
+
86
+ # Pre-Approved Read-Only Actions
87
+
88
+ - Inspect source, tests, configs, scripts, generated references, and mdkg graph.
89
+ - Run local search, lint, format check, tests/builds, and static analysis tools
90
+ that do not call external services.
91
+ - Create mdkg evidence, consolidation proposals, tasks, tests, and open
92
+ questions.
93
+
94
+ # Approval-Gated Actions
95
+
96
+ - Functional refactors, formatting rewrites, generated updates, or dependency
97
+ changes.
98
+ - External tools or service calls.
99
+
100
+ # Blocker Continuation
101
+
102
+ If tools cannot run locally, create a spike, propose at least three options for
103
+ proof, recommend one path, mark blocker evidence, and continue search-based
104
+ source review and config inspection.
105
+
106
+ Do not mark the whole loop blocked while another duplicate/lint lane remains
107
+ actionable. Do not close the loop until required lanes are complete or linked to
108
+ accepted `decision_refs` or `approval_refs`.
109
+
110
+ # Closeout Matrix
111
+
112
+ Classify follow-up work as definition-blocking tool evidence, residual
113
+ consolidation, accepted waiver, or false positive before marking the loop done
114
+ or blocked.