@walwal-harness/cli 7.1.25 → 7.1.26

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.
package/CHANGELOG.md CHANGED
@@ -31,6 +31,16 @@ docmeta:
31
31
 
32
32
  ## Unreleased
33
33
 
34
+ ## 7.1.26 — Lazy rule links + MCP steward (2026-05-27)
35
+
36
+ ### Added
37
+ - COO planning can hire `support-support-mcp-registry-steward` to inventory Claude/Codex MCP capabilities, registration risk, credentials, and maintenance notes.
38
+ - CXX convention/gotcha files now act as lazy-loading indexes that link to topic files such as `i18n-locale-hotfix.md`.
39
+
40
+ ### Changed
41
+ - `migrate` preserves topic-specific convention/gotcha files and adds related links to matching CXX index files instead of merging or deleting them.
42
+ - CXX and worker guidance now passes only relevant convention/gotcha links to workers, avoiding full-registry scans.
43
+
34
44
  ## 7.1.25 — Absolute Claude hook paths + Codex adapter docs (2026-05-26)
35
45
 
36
46
  ### Fixed
@@ -9,6 +9,10 @@ disable-model-invocation: false
9
9
 
10
10
  Own design strategy for the mission.
11
11
 
12
+ ## Lazy Rule Loading
13
+
14
+ Before design work, read `.harness/conventions/shared.md`, `.harness/conventions/cdo.md`, `.harness/gotchas/shared.md`, and `.harness/gotchas/cdo.md`. Then follow only the related links in `cdo.md` files that match the mission topic. Worker briefs must pass the relevant links instead of asking workers to scan all rule files.
15
+
12
16
  ## Workflow
13
17
 
14
18
  1. Read CEO and COO mission context.
@@ -9,6 +9,15 @@ disable-model-invocation: false
9
9
 
10
10
  You are the only direct conversation channel with the Owner.
11
11
 
12
+ ## Lazy Rule Loading
13
+
14
+ Before routing or accepting CXX work, enforce lazy loading:
15
+
16
+ - CEO reads `.harness/conventions/shared.md`, `.harness/conventions/ceo.md`, `.harness/gotchas/shared.md`, and `.harness/gotchas/ceo.md`.
17
+ - Each CXX reads its own `.harness/conventions/{cxx}.md` and `.harness/gotchas/{cxx}.md`, then follows only the related links in those files that match the mission topic.
18
+ - Topic files such as `.harness/gotchas/i18n-locale-hotfix.md` remain separate. CXX index files carry links to them; they are not merged into one large file.
19
+ - Workers receive the relevant CXX link set in their brief instead of scanning every convention/gotcha file.
20
+
12
21
  ## Mission Protocol
13
22
 
14
23
  1. Read the Owner request and decide whether brainstorming is needed or execution can start.
@@ -9,11 +9,26 @@ disable-model-invocation: false
9
9
 
10
10
  Own mission planning, research, references, hypotheses, and goal fit.
11
11
 
12
+ ## Lazy Rule Loading
13
+
14
+ Before planning, read `.harness/conventions/shared.md`, `.harness/conventions/coo.md`, `.harness/gotchas/shared.md`, and `.harness/gotchas/coo.md`. Then follow only the related links in `coo.md` files that match the mission topic. Worker briefs must pass the relevant links instead of asking workers to scan all rule files.
15
+
16
+ ## MCP Capability Scan
17
+
18
+ During planning, COO must determine whether the active runtime exposes MCP servers, MCP tools, connector tools, or tool-discovery tools that can materially improve the mission. This is a planning input, not an implementation shortcut.
19
+
20
+ - Before finalizing a plan, create a worker task for an MCP capability scan. Prefer `support-support-mcp-registry-steward` when available; otherwise hire the smallest worker that can inventory Claude/Codex MCP availability without inventing unavailable tools.
21
+ - The worker must use only discovery mechanisms actually exposed in the current runtime, such as MCP resource/tool listing, connector search, or tool-discovery tools. Do not invent unavailable MCPs.
22
+ - The inventory must classify each applicable MCP by purpose, required credentials or setup, read/write risk, expected value, and where it fits in the mission flow.
23
+ - If no discovery mechanism is exposed, or no applicable MCP is available, record that explicitly in the worker report and proceed without MCP dependency.
24
+ - COO may recommend MCP usage only when the worker report shows that the tool is available, applicable, and safer or more efficient than the non-MCP path.
25
+ - COO must route execution of any MCP-dependent implementation, verification, or operational work to the responsible CXX and hired workers. COO does not call MCP tools to complete specialist deliverables.
26
+
12
27
  ## Workflow
13
28
 
14
29
  1. Read `.harness/documents/{mission_name}/ceo.md`.
15
30
  2. Record work in `.harness/documents/{mission_name}/coo.md`.
16
- 3. Break the COO scope into worker tasks: research, planning, hypothesis validation, backtest design, documentation, or product direction.
31
+ 3. Break the COO scope into worker tasks: research, planning, MCP capability scan, hypothesis validation, backtest design, documentation, or product direction.
17
32
  4. Use the `harness-resource-manager` skill to check available workers for every task.
18
33
  5. Use the `harness-hiring` skill before assigning any task that has no hired worker. Do not complete that task yourself.
19
34
  6. Delegate all COO deliverables to hired workers in fresh sessions.
@@ -36,8 +51,9 @@ Required output sections:
36
51
 
37
52
  1. Worker Task Briefs — task, capability needed, selected worker or hiring request, acceptance criteria.
38
53
  2. Worker Evidence Manifest — worker name, report path, status.
39
- 3. COO Decision — only decisions accepted from worker evidence.
40
- 4. Next Handoff — next CXX, inputs, blockers.
41
- 5. Implementation Notes — in English, with `Design Decisions`, `Deviations`, `Tradeoffs`, and `Open Questions`.
54
+ 3. MCP Capability Inventory — available/applicable MCPs, required setup, read/write risk, recommended use, or explicit `None`.
55
+ 4. COO Decision — only decisions accepted from worker evidence.
56
+ 5. Next Handoff — next CXX, inputs, blockers.
57
+ 6. Implementation Notes — in English, with `Design Decisions`, `Deviations`, `Tradeoffs`, and `Open Questions`.
42
58
 
43
59
  Every COO worker brief must require the worker to append the same English `## Implementation Notes` block to the bottom of `.harness/documents/{mission_name}/coo/workers/{worker-name}.md`, covering risks, self-corrections, chosen direction, and unresolved questions. Use `None` for empty subsections.
@@ -9,6 +9,10 @@ disable-model-invocation: false
9
9
 
10
10
  Own quality, recurrence prevention, and archive eligibility.
11
11
 
12
+ ## Lazy Rule Loading
13
+
14
+ Before quality work, read `.harness/conventions/shared.md`, `.harness/conventions/cqo.md`, `.harness/gotchas/shared.md`, and `.harness/gotchas/cqo.md`. Then follow only the related links in `cqo.md` files that match the mission topic, such as i18n, regression, accessibility, API, runtime, or incident links. Worker briefs must pass the relevant links instead of asking workers to scan all rule files.
15
+
12
16
  ## Workflow
13
17
 
14
18
  1. Read CEO and CTO mission context.
@@ -9,6 +9,10 @@ disable-model-invocation: false
9
9
 
10
10
  Own engineering execution for the mission.
11
11
 
12
+ ## Lazy Rule Loading
13
+
14
+ Before engineering work, read `.harness/conventions/shared.md`, `.harness/conventions/cto.md`, `.harness/gotchas/shared.md`, and `.harness/gotchas/cto.md`. Then follow only the related links in `cto.md` files that match the mission topic, such as i18n, auth, API, runtime, or platform links. Worker briefs must pass the relevant links instead of asking workers to scan all rule files.
15
+
12
16
  ## Workflow
13
17
 
14
18
  1. Read CEO, COO, and CDO mission documents.
@@ -26,7 +26,11 @@ Hire workers from `.harness/shared/HR-Resource/`.
26
26
  5. Update `.harness/shared/hr-roster.json` without deleting existing hired entries. Record `owner` as the owning CXX, `skillPath` as `.harness/shared/HR-Resource/{name}/SKILL.md`, and `skillPaths.claude` / `skillPaths.codex` as tool-specific hierarchical installed paths.
27
27
  6. The owning CXX must write worker reports under `.harness/documents/{mission}/{owning-cxx}/workers/{name}.md`. Do not write flat `.harness/documents/{mission}/workers/{name}.md` except when migrating legacy missions.
28
28
  7. Ask the `harness-resource-manager` skill to update trigger wording.
29
- 8. Return worker name, owner, source skill path, installed paths, mission report path, invocation wording, and the mandatory report appendix below.
29
+ 8. Return worker name, owner, source skill path, installed paths, mission report path, invocation wording, related convention/gotcha links supplied by the owning CXX, and the mandatory report appendix below.
30
+
31
+ ## Worker Rule Links
32
+
33
+ Every hired worker receives the owning CXX's relevant convention/gotcha links in the worker brief. Workers read those linked topic files only when they match the assigned task.
30
34
 
31
35
  ## Mandatory Worker Report Appendix
32
36
 
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "source": "/Users/ted/Downloads/agency-agents-main",
3
3
  "imported_at": "2026-05-11T08:05:46.803Z",
4
- "count": 179,
4
+ "count": 180,
5
5
  "resources": [
6
6
  {
7
7
  "sourceRel": "academic/academic-anthropologist.md",
@@ -679,6 +679,10 @@
679
679
  "sourceRel": "support/support-infrastructure-maintainer.md",
680
680
  "skillName": "support-support-infrastructure-maintainer"
681
681
  },
682
+ {
683
+ "sourceRel": "support/support-mcp-registry-steward.md",
684
+ "skillName": "support-support-mcp-registry-steward"
685
+ },
682
686
  {
683
687
  "sourceRel": "support/support-legal-compliance-checker.md",
684
688
  "skillName": "support-support-legal-compliance-checker"
@@ -9,6 +9,10 @@ disable-model-invocation: false
9
9
 
10
10
  Monitor the environments that make the mission runnable.
11
11
 
12
+ ## Lazy Rule Loading
13
+
14
+ Before monitoring work, read `.harness/conventions/shared.md`, `.harness/conventions/ops.md`, `.harness/gotchas/shared.md`, and `.harness/gotchas/ops.md`. Then follow only the related links in `ops.md` files that match the mission topic, such as runtime, port, log, production, or incident links. Worker briefs must pass the relevant links instead of asking workers to scan all rule files.
15
+
12
16
  OPS owns three environment classes:
13
17
 
14
18
  - Build environment: command-based local execution such as `flutter run`, `npm run dev`, test watchers, local build scripts, and other foreground/background commands used by CXX workers.
@@ -16,15 +16,18 @@ Manage worker availability and invocation wording.
16
16
  - Candidate pool: `.harness/shared/HR-Resource/*/SKILL.md`
17
17
  - Installed hired workers: `.claude/skills/{owning-cxx}/{worker}/SKILL.md` and `.codex/skills/{owning-cxx}/{worker}/SKILL.md`
18
18
  - Mission worker reports: `.harness/documents/{mission}/{owning-cxx}/workers/{worker}.md`
19
+ - Related convention/gotcha links: selected from `.harness/conventions/{owning-cxx}.md` and `.harness/gotchas/{owning-cxx}.md`
19
20
 
20
21
  ## Workflow
21
22
 
22
23
  1. Check whether the requester is a CXX. CEO cannot request specialist worker assignment directly.
23
24
  2. Check whether a suitable worker is already hired for that owning CXX.
24
- 3. If hired, return the exact skill name, owning CXX, hierarchical installed paths, mission report path, and the mandatory `## Implementation Notes` report appendix requirement.
25
+ 3. If hired, return the exact skill name, owning CXX, hierarchical installed paths, relevant convention/gotcha links, mission report path, and the mandatory `## Implementation Notes` report appendix requirement.
25
26
  4. If not hired, suggest `.harness/shared/HR-Resource/` candidates and recommend the `harness-hiring` skill with `owning CXX` filled in.
26
27
  5. Keep aliases narrow enough to avoid accidental generic invocation.
27
28
 
28
29
  ## Mandatory Worker Report Appendix
29
30
 
31
+ Every worker assignment must include only the convention/gotcha links relevant to the assigned task. The owning CXX selects those links from its CXX index files.
32
+
30
33
  Every worker assignment must require the worker to append an English `## Implementation Notes` section with these subsections: `Design Decisions`, `Deviations`, `Tradeoffs`, and `Open Questions`. The appendix must cover risks, self-corrections, chosen direction, and unresolved questions. Use `None` for empty subsections.
@@ -0,0 +1,77 @@
1
+ ---
2
+ name: support-support-mcp-registry-steward
3
+ description: "MCP registry steward for Claude and Codex. Inventories available MCP servers/tools, recommends safe registration, and maintains project MCP usage records without inventing unavailable capabilities."
4
+ model: sonnet
5
+ disable-model-invocation: false
6
+ ---
7
+
8
+ # MCP Registry Steward
9
+
10
+ You manage Model Context Protocol capability discovery, registration guidance, and maintenance for Claude and Codex runtimes.
11
+
12
+ ## Mission
13
+
14
+ Help COO and the responsible CXX decide whether MCP tools should be used for a mission, and keep the decision auditable.
15
+
16
+ ## Scope
17
+
18
+ - Inventory MCP servers, MCP tools, connector tools, and tool-discovery mechanisms actually exposed in the current runtime.
19
+ - Compare Claude and Codex availability separately. A tool available in one runtime is not automatically available in the other.
20
+ - Recommend registration only when the MCP is useful, credentials/setup are clear, and read/write risk is acceptable.
21
+ - Maintain a project MCP capability record for future missions.
22
+ - Produce handoff notes for the CXX or worker that will actually use the MCP.
23
+
24
+ ## Discovery Rules
25
+
26
+ 1. Use only discovery mechanisms exposed in the active runtime.
27
+ 2. Do not invent MCP servers, tools, connector names, credentials, or config paths.
28
+ 3. If no discovery mechanism is available, record `None` with the exact reason.
29
+ 4. Treat write-capable MCPs as higher risk than read-only MCPs.
30
+ 5. Never edit global Claude, Codex, or user-level MCP configuration without explicit Owner approval.
31
+ 6. Prefer project-local documentation and registration instructions over hidden global state.
32
+
33
+ ## Claude Checks
34
+
35
+ - Inspect project and user-visible Claude MCP configuration only when accessible.
36
+ - Record server name, command, args, required environment variables, and whether tools are read-only or write-capable.
37
+ - If Claude exposes MCP tool namespaces in the active session, list the tool names used for discovery.
38
+ - If Playwright MCP is needed, verify whether project guidance already references it and whether setup instructions are present.
39
+
40
+ ## Codex Checks
41
+
42
+ - Inspect Codex-visible tool discovery, MCP resources, connector tools, and local project instructions.
43
+ - Record whether MCP discovery is exposed directly, only through connector/tool search, or not exposed.
44
+ - If a Claude MCP is not available to Codex, mark it as Claude-only until Codex registration is confirmed.
45
+ - Do not assume `.claude` MCP configuration applies to Codex.
46
+
47
+ ## Registration Review
48
+
49
+ For every proposed MCP registration, document:
50
+
51
+ - Purpose and mission fit.
52
+ - Runtime target: Claude, Codex, or both.
53
+ - Required credentials, environment variables, binaries, and network access.
54
+ - Read/write risk and blast radius.
55
+ - Suggested project-local docs or setup command.
56
+ - Validation command or manual smoke test.
57
+ - Rollback or disable procedure.
58
+
59
+ ## Maintenance Record
60
+
61
+ Write or update a worker report under:
62
+
63
+ `.harness/documents/{mission}/coo/workers/support-support-mcp-registry-steward.md`
64
+
65
+ Required sections:
66
+
67
+ 1. `## MCP Capability Inventory`
68
+ 2. `## Claude Runtime`
69
+ 3. `## Codex Runtime`
70
+ 4. `## Registration Candidates`
71
+ 5. `## Risk Review`
72
+ 6. `## Maintenance Plan`
73
+ 7. `## Recommended Mission Use`
74
+ 8. `## Implementation Notes`
75
+
76
+ Use `None` for empty sections. Include exact evidence paths or tool names for every claim.
77
+
package/README.md CHANGED
@@ -216,6 +216,8 @@ Hourly autonomous wake:
216
216
  - Each wake tick prompts CEO to convene CXX + OPS, collect progress and decisions, dispatch the next action without asking Owner, and require CQO/OPS verification until the active goal works.
217
217
  - `npx @walwal-harness/cli migrate` refreshes package-owned runtime scripts, so existing projects receive wake prompt updates without a full re-init.
218
218
  - In Codex, `.codex/skills/**/SKILL.md` files are the runtime protocol. `.codex/agents/` is not required; Codex should manually read the relevant skill if it is not auto-listed.
219
+ - Convention/gotcha topic files lazy-load through CXX index links: `migrate` preserves files such as `.harness/gotchas/i18n-locale-hotfix.md` and links them from relevant CXX files like `cto.md` and `cqo.md`.
220
+ - COO can use `support-support-mcp-registry-steward` to inventory Claude/Codex MCP capabilities, registration risk, credentials, and maintenance notes before recommending MCP use.
219
221
 
220
222
  ---
221
223
 
@@ -227,8 +229,8 @@ Hourly autonomous wake:
227
229
  | `.harness/documents/goal-{index}-{name}/submission-{index}-{name}/` | Additional requirement under the active goal |
228
230
  | `.harness/documents/goal-{index}-{name}/hotfix-{index}-{name}/` | Emergency fix under the active goal |
229
231
  | `.harness/documents/{goal-or-child-mission}/{cxx}/workers/` | Worker reports owned by that CXX |
230
- | `.harness/conventions/` | Durable rules (CQO writes, survives missions) |
231
- | `.harness/gotchas/` | Recurrence-prevention records (CQO registers per hot-fix) |
232
+ | `.harness/conventions/` | Durable rules and CXX lazy-loading indexes |
233
+ | `.harness/gotchas/` | Recurrence-prevention records and CXX lazy-loading indexes |
232
234
  | `.harness/shared/HR-Resource/` | Hireable worker skill pool |
233
235
  | `.harness/archive/` | CQO-approved completed missions (immutable) |
234
236
  | `.harness/logs/YYYY-MM-DD/` | OPS exception logs |
@@ -144,6 +144,7 @@ Note: A docmeta skip decision on harness documents (ceo.md, cto.md, cqo.md, work
144
144
  8. **No CXX self-execution** — CXX agents coordinate and manage only. A CXX that produces deliverables without matching worker records has violated its scope. CEO must reject such reports.
145
145
  9. **No verdict without worker evidence** — CQO cannot issue ACCEPTED/REJECTED without a Worker Evidence Manifest referencing at least one evaluator worker. Self-inspection by CQO is not valid evidence.
146
146
  10. **Hierarchical worker ownership** — Hired workers are installed under `.claude/skills/{owning-cxx}/{worker}/` and `.codex/skills/{owning-cxx}/{worker}/`; mission worker reports live under `.harness/documents/{goal-or-child-mission}/{owning-cxx}/workers/`. Flat `{mission}/workers/` reports are legacy and signal an ownership violation unless explicitly migrated.
147
+ 11. **Lazy convention/gotcha loading** — CXX roles read `.harness/conventions/shared.md`, `.harness/conventions/{cxx}.md`, `.harness/gotchas/shared.md`, and `.harness/gotchas/{cxx}.md`, then follow only the related topic links listed in those CXX files. Workers read only the related links supplied by their owning CXX.
147
148
  11. **Implementation Notes required** — `ceo.md`, every `{cxx}.md`, and every worker report must end with one English `## Implementation Notes` section containing `Design Decisions`, `Deviations`, `Tradeoffs`, and `Open Questions`. Use `None` for empty subsections. Do not create a separate sidecar notes file; the notes belong at the bottom of the same role or worker report that produced the decision/evidence.
148
149
  12. **Owner is final acceptance only** — Owner is not a tester or QA substitute. CEO/CXX must not report "done, please check" until worker-backed verification proves the goal can be completed. Use unit tests, E2E, Playwright, test accounts, seeded data, build/run checks, logs, and CQO evidence before requesting Owner acceptance.
149
150
  13. **OPS watches CQO verification** — For runnable products, CQO PASS is invalid unless OPS has monitored the verification runtime or documented why OPS watch is not applicable. Open OPS incidents, missing runtime mapping, required log gaps, service down, health mismatch, or an unmonitored tested service block Owner acceptance.
@@ -262,7 +262,7 @@
262
262
  "actions": ".harness/actions",
263
263
  "archive": ".harness/archive",
264
264
  "gotchas": ".harness/gotchas",
265
- "conventions": "CONVENTIONS.md",
265
+ "conventions": ".harness/conventions",
266
266
  "progress_state": ".harness/progress.json",
267
267
  "progress_log": ".harness/progress.log"
268
268
  },
@@ -284,16 +284,18 @@
284
284
  "statuses": ["start", "complete", "fail", "pass", "skip", "warn"]
285
285
  },
286
286
  "conventions": {
287
- "comment": "House-style registry. 루트 CONVENTIONS.md(사용자 자유 기술) + .harness/conventions/<scope>.md(Dispatcher 자동 누적). 모든 에이전트가 세션 시작 시 읽고 적용한다. Gotcha 의 긍정 대칭판.",
287
+ "comment": "House-style registry. CXX files act as lazy-loading indexes that link to topic-specific convention/gotcha documents.",
288
288
  "root_file": "CONVENTIONS.md",
289
289
  "scoped_dir": ".harness/conventions/",
290
- "scopes": ["shared", "planner", "generator-backend", "generator-frontend", "evaluator-code-quality", "evaluator-functional", "evaluator-visual"],
290
+ "gotcha_scoped_dir": ".harness/gotchas/",
291
+ "cxx_scopes": ["ceo", "coo", "cdo", "cto", "cqo", "ops", "hiring", "resource-manager", "brick-office"],
291
292
  "entry_id_prefix": "C",
292
- "read_by": "all_agents",
293
- "read_order": ["CONVENTIONS.md", ".harness/conventions/shared.md", ".harness/conventions/<self>.md", ".harness/gotchas/<self>.md", ".harness/memory.md"],
294
- "conflict_priority": "self > shared > root",
295
- "write_by": "dispatcher (auto-append C-NNN) or user_only (manual edit)",
296
- "read_timing": "session_start",
293
+ "read_by": "CEO, CXX, and hired workers",
294
+ "cxx_read_order": [".harness/conventions/shared.md", ".harness/conventions/<cxx>.md", "follow relevant links in <cxx>.md", ".harness/gotchas/shared.md", ".harness/gotchas/<cxx>.md", "follow relevant links in <cxx>.md", ".harness/memory.md"],
295
+ "worker_read_order": ["links explicitly provided by owning CXX in the worker brief"],
296
+ "conflict_priority": "linked topic > owning-cxx > shared > memory > root",
297
+ "write_by": "CQO/gotcha-register, CXX, or Owner-approved manual edit",
298
+ "read_timing": "before each role or worker starts mission work",
297
299
  "preserve_on_postinstall": true
298
300
  },
299
301
  "recommended_skills": {
package/bin/init.js CHANGED
@@ -527,7 +527,6 @@ function scaffoldHarness() {
527
527
  copyFile(srcPath, destPath);
528
528
  }
529
529
  }
530
-
531
530
  // Copy conventions — mirror gotchas preservation: never overwrite files with
532
531
  // accumulated `### [C-NNN]` entries.
533
532
  const conventionsSrc = path.join(PKG_ROOT, 'conventions');
@@ -550,7 +549,6 @@ function scaffoldHarness() {
550
549
  copyFile(srcPath, destPath);
551
550
  }
552
551
  }
553
-
554
552
  // First-install migration: extract Convention/Gotcha-shaped sections from
555
553
  // existing CLAUDE.md / AGENTS.md and copy into the hierarchical stores.
556
554
  if (isFirstInstall) {
@@ -1265,6 +1263,7 @@ function detectMigrationNeeded() {
1265
1263
  memoryMissingSystemEntries: [],
1266
1264
  gotchaMissingEntries: {}, // { "<filename>": [G-IDs...] }
1267
1265
  conventionMissingEntries: {}, // { "<filename>": [C-IDs...] }
1266
+ ruleRegistryLinks: [],
1268
1267
  bundleVersionStale: null, // { current, installed }
1269
1268
  };
1270
1269
 
@@ -1418,6 +1417,7 @@ function detectMigrationNeeded() {
1418
1417
  flags.memoryMissingSystemEntries = tplEntryIds.filter((id) => !userEntryIds.has(id));
1419
1418
  } catch {}
1420
1419
  }
1420
+ flags.ruleRegistryLinks = detectRuleRegistryLinks();
1421
1421
  return flags;
1422
1422
  }
1423
1423
 
@@ -1479,6 +1479,136 @@ function extractConventionEntryBlock(md, id) {
1479
1479
  return m ? m[1].trimEnd() : null;
1480
1480
  }
1481
1481
 
1482
+ const CANONICAL_RULE_SCOPES = new Set([
1483
+ 'README.md',
1484
+ 'shared.md',
1485
+ 'ceo.md',
1486
+ 'coo.md',
1487
+ 'cdo.md',
1488
+ 'cto.md',
1489
+ 'cqo.md',
1490
+ 'ops.md',
1491
+ 'hiring.md',
1492
+ 'resource-manager.md',
1493
+ 'brick-office.md',
1494
+ ]);
1495
+
1496
+ const CXX_RULE_LINK_MARKER = '<!-- walwal-harness:related-rule-links -->';
1497
+
1498
+ function collectKnownWorkerNames() {
1499
+ const names = new Set();
1500
+ const hrRoot = path.join(HARNESS_DIR, 'shared', 'HR-Resource');
1501
+ if (fs.existsSync(hrRoot)) {
1502
+ for (const entry of fs.readdirSync(hrRoot, { withFileTypes: true })) {
1503
+ if (entry.isDirectory()) names.add(entry.name);
1504
+ }
1505
+ }
1506
+ const rosterPath = path.join(HARNESS_DIR, 'shared', 'hr-roster.json');
1507
+ if (fs.existsSync(rosterPath)) {
1508
+ try {
1509
+ const roster = JSON.parse(fs.readFileSync(rosterPath, 'utf8'));
1510
+ for (const entry of Array.isArray(roster.hired) ? roster.hired : []) {
1511
+ if (entry?.worker) names.add(entry.worker);
1512
+ }
1513
+ } catch {}
1514
+ }
1515
+ return names;
1516
+ }
1517
+
1518
+ function classifyRuleRegistryFile(file, kind, knownWorkers, body = '') {
1519
+ const base = path.basename(file, '.md');
1520
+ const ext = path.extname(file);
1521
+ if (ext !== '.md') return null;
1522
+ if (LEGACY_V7_FILE_OWNER[file]) {
1523
+ return { targets: [path.basename(LEGACY_V7_FILE_OWNER[file], '.md')], reason: 'legacy-role' };
1524
+ }
1525
+ const haystack = `${base}\n${body}`.toLowerCase();
1526
+ const targets = new Set();
1527
+
1528
+ if (/\b(i18n|intl|locale|localization|translation|translate|multilingual|language|aria|rtl|l10n)\b/.test(haystack)) {
1529
+ targets.add('cto');
1530
+ targets.add('cqo');
1531
+ }
1532
+ if (/\b(ui|ux|design|brand|visual|layout|accessibility|a11y|responsive|color|typography)\b/.test(haystack)) {
1533
+ targets.add('cdo');
1534
+ targets.add('cqo');
1535
+ }
1536
+ if (/\b(api|backend|frontend|database|schema|auth|flutter|react|next|build|deploy|port|integration|migration)\b/.test(haystack)) {
1537
+ targets.add('cto');
1538
+ }
1539
+ if (/\b(test|qa|quality|regression|e2e|playwright|bug|hotfix|incident|failure|risk)\b/.test(haystack)) {
1540
+ targets.add('cqo');
1541
+ }
1542
+ if (/\b(ops|runtime|server|log|monitor|health|production|docker|port)\b/.test(haystack)) {
1543
+ targets.add('ops');
1544
+ }
1545
+ if (/\b(plan|research|market|hypothesis|requirement|product|scope)\b/.test(haystack)) {
1546
+ targets.add('coo');
1547
+ }
1548
+ if (knownWorkers.has(base)) {
1549
+ return { targets: ['coo', 'cto', 'cqo', 'ops'].filter(Boolean), reason: 'worker-topic' };
1550
+ }
1551
+ if (!targets.size) targets.add('shared');
1552
+ return { targets: [...targets], reason: targets.has('shared') ? 'unclassified-topic' : 'topic-keywords' };
1553
+ }
1554
+
1555
+ function detectRuleRegistryLinks() {
1556
+ const links = [];
1557
+ const knownWorkers = collectKnownWorkerNames();
1558
+ for (const kind of ['conventions', 'gotchas']) {
1559
+ const root = path.join(HARNESS_DIR, kind);
1560
+ if (!fs.existsSync(root)) continue;
1561
+ for (const entry of fs.readdirSync(root, { withFileTypes: true })) {
1562
+ if (entry.isDirectory()) continue;
1563
+ if (!entry.isFile() || !entry.name.endsWith('.md')) continue;
1564
+ if (CANONICAL_RULE_SCOPES.has(entry.name)) continue;
1565
+ const sourcePath = path.join(root, entry.name);
1566
+ const body = fs.existsSync(sourcePath) ? fs.readFileSync(sourcePath, 'utf8') : '';
1567
+ const classification = classifyRuleRegistryFile(entry.name, kind, knownWorkers, body);
1568
+ if (!classification) continue;
1569
+ links.push({
1570
+ kind,
1571
+ sourceRel: entry.name,
1572
+ targets: classification.targets,
1573
+ reason: classification.reason,
1574
+ });
1575
+ }
1576
+ }
1577
+ return links.filter((item) => item.targets.some((target) => !ruleRegistryLinkExists(item.kind, target, item.sourceRel)));
1578
+ }
1579
+
1580
+ function ruleRegistryLinkExists(kind, target, sourceRel) {
1581
+ const targetPath = path.join(HARNESS_DIR, kind, `${target}.md`);
1582
+ if (!fs.existsSync(targetPath)) return false;
1583
+ return fs.readFileSync(targetPath, 'utf8').includes(`](${sourceRel})`);
1584
+ }
1585
+
1586
+ function updateRuleRegistryLinks(links, { dryRun, backupDir }) {
1587
+ if (!links.length) return;
1588
+ for (const item of links) {
1589
+ const root = path.join(HARNESS_DIR, item.kind);
1590
+ const sourcePath = path.join(root, item.sourceRel);
1591
+ if (!fs.existsSync(sourcePath)) continue;
1592
+ for (const target of item.targets) {
1593
+ const targetPath = path.join(root, `${target}.md`);
1594
+ if (path.resolve(sourcePath) === path.resolve(targetPath) || ruleRegistryLinkExists(item.kind, target, item.sourceRel)) continue;
1595
+ log(` ${item.kind}/${target}.md: link ${item.sourceRel} (${item.reason})`);
1596
+ if (dryRun) continue;
1597
+ ensureDir(path.dirname(targetPath));
1598
+ const existing = fs.existsSync(targetPath) ? fs.readFileSync(targetPath, 'utf8').trimEnd() : `# ${target.toUpperCase()} ${item.kind === 'gotchas' ? 'Gotchas' : 'Conventions'}`;
1599
+ if (fs.existsSync(targetPath)) {
1600
+ const backupTarget = path.join(backupDir, `${item.kind}-${target}.md`);
1601
+ fs.copyFileSync(targetPath, backupTarget);
1602
+ }
1603
+ const header = existing.includes(CXX_RULE_LINK_MARKER)
1604
+ ? ''
1605
+ : `\n\n## Related ${item.kind === 'gotchas' ? 'Gotcha' : 'Convention'} Links\n${CXX_RULE_LINK_MARKER}\n`;
1606
+ const line = `- [${item.sourceRel}](${item.sourceRel}) — ${item.reason}`;
1607
+ fs.writeFileSync(targetPath, `${existing}${header}${header ? '' : '\n'}${line}\n`);
1608
+ }
1609
+ }
1610
+ }
1611
+
1482
1612
  function showMigrationProposal(flags) {
1483
1613
  console.log('');
1484
1614
  console.log('╔══════════════════════════════════════════════════════════╗');
@@ -1544,6 +1674,12 @@ function showMigrationProposal(flags) {
1544
1674
  console.log(` ${file}: [${ids.join(', ')}]`);
1545
1675
  }
1546
1676
  }
1677
+ if (flags.ruleRegistryLinks && flags.ruleRegistryLinks.length) {
1678
+ console.log(' • conventions/gotchas: topic 파일을 CXX index 에 link 하여 lazy-load 가능하게 보강');
1679
+ for (const item of flags.ruleRegistryLinks) {
1680
+ console.log(` ${item.kind}/${item.sourceRel} → ${item.targets.map((t) => `${item.kind}/${t}.md`).join(', ')} (${item.reason})`);
1681
+ }
1682
+ }
1547
1683
  if (flags.bundleVersionStale) {
1548
1684
  const { current, installed } = flags.bundleVersionStale;
1549
1685
  console.log(` • bundle: ${installed ?? '(없음)'} → ${current} 스탬프 갱신 필요`);
@@ -1572,6 +1708,7 @@ function runMigrate(opts = {}) {
1572
1708
  const runtimeScriptsAlwaysRefresh = true;
1573
1709
  const gotchaMissingTotal = Object.values(flags.gotchaMissingEntries || {}).reduce((n, a) => n + a.length, 0);
1574
1710
  const conventionMissingTotal = Object.values(flags.conventionMissingEntries || {}).reduce((n, a) => n + a.length, 0);
1711
+ const ruleRegistryLinkTotal = (flags.ruleRegistryLinks || []).length;
1575
1712
  if (
1576
1713
  !flags.progressV3toV4 &&
1577
1714
  !flags.progressLegacyRouting &&
@@ -1588,6 +1725,7 @@ function runMigrate(opts = {}) {
1588
1725
  (!flags.memoryMissingSystemEntries || flags.memoryMissingSystemEntries.length === 0) &&
1589
1726
  gotchaMissingTotal === 0 &&
1590
1727
  conventionMissingTotal === 0 &&
1728
+ ruleRegistryLinkTotal === 0 &&
1591
1729
  !flags.bundleVersionStale &&
1592
1730
  !runtimeScriptsAlwaysRefresh
1593
1731
  ) {
@@ -1608,6 +1746,7 @@ function runMigrate(opts = {}) {
1608
1746
  // Runtime scripts are package-owned. Migrate must refresh them so existing
1609
1747
  // projects receive wake/meeting/OPS fixes without requiring a full init.
1610
1748
  refreshScriptsForMigrate({ dryRun, backupDir });
1749
+ updateRuleRegistryLinks(flags.ruleRegistryLinks || [], { dryRun, backupDir });
1611
1750
 
1612
1751
  // 1. progress.json
1613
1752
  const progressPath = path.join(HARNESS_DIR, 'progress.json');
@@ -15,4 +15,6 @@ Only company-level roles are provided by default:
15
15
  - `resource-manager.md`
16
16
  - `brick-office.md`
17
17
 
18
- Specialist worker conventions are not bundled here. They are created or promoted later through hiring, mission work, and CQO memory hygiene.
18
+ Topic-specific convention files may use descriptive names such as `i18n-locale.md`.
19
+
20
+ CXX files such as `cto.md` and `cqo.md` act as lazy-loading indexes. Add links there when a topic file applies to that CXX.
@@ -2,5 +2,6 @@
2
2
 
3
3
  - COO owns planning, research, service direction, reference models, and hypothesis validation.
4
4
  - COO records decisions in `.harness/documents/{mission_name}/coo.md`.
5
- - COO hires researchers, product planners, junior experiment developers, and documentation workers before delegating specialist work.
5
+ - COO hires researchers, product planners, MCP registry stewards/capability scanners, junior experiment developers, and documentation workers before delegating specialist work.
6
+ - COO planning must include an MCP Capability Inventory: available/applicable MCPs, required setup, read/write risk, recommended mission use, or explicit `None` when discovery is unavailable or no MCP applies.
6
7
  - COO reports mission fit, evidence, rejected options, and recommended next CXX to CEO.
package/gotchas/README.md CHANGED
@@ -15,4 +15,6 @@ Only company-level roles are provided by default:
15
15
  - `resource-manager.md`
16
16
  - `brick-office.md`
17
17
 
18
- Specialist worker gotchas are not bundled. CQO promotes recurring verified failures into this store as the company learns.
18
+ Topic-specific gotcha files may use descriptive names such as `i18n-locale-hotfix.md`.
19
+
20
+ CXX files such as `cto.md` and `cqo.md` act as lazy-loading indexes. Add links there when a topic file applies to that CXX.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@walwal-harness/cli",
3
- "version": "7.1.25",
3
+ "version": "7.1.26",
4
4
  "description": "Company-style AI agent harness for Claude and Codex. Installs commands, CXX agents, skills, HR-Resource hiring pool, and project-local .harness runtime state.",
5
5
  "bin": {
6
6
  "walwal-harness": "bin/init.js"
@@ -70,6 +70,7 @@ TODAY="$(date +%Y-%m-%d)"
70
70
  register_one() {
71
71
  local target="$1" rule_id="$2" title="$3" wrong="$4" right="$5" why="$6" scope="$7" source="$8"
72
72
  local file="$GOTCHAS_DIR/${target}.md"
73
+ mkdir -p "$(dirname "$file")"
73
74
 
74
75
  # Ensure file exists with header
75
76
  if [ ! -f "$file" ]; then
@@ -184,6 +185,7 @@ register_convention_one() {
184
185
  local scope="$1" rule_id="$2" title="$3" rule="$4" why="$5" source="$6"
185
186
  mkdir -p "$CONVENTIONS_DIR"
186
187
  local file="$CONVENTIONS_DIR/${scope}.md"
188
+ mkdir -p "$(dirname "$file")"
187
189
 
188
190
  if [ ! -f "$file" ]; then
189
191
  cat > "$file" <<EOF