Skip to content

Layer the Tool runtime by Area and Domain, and retire the legacy interface closure - #180

Merged
KimGLee merged 5 commits into
mainfrom
refactor/tool-runtime-layering
Sep 1, 2026
Merged

Layer the Tool runtime by Area and Domain, and retire the legacy interface closure#180
KimGLee merged 5 commits into
mainfrom
refactor/tool-runtime-layering

Conversation

@KimGLee

@KimGLee KimGLee commented Sep 1, 2026

Copy link
Copy Markdown
Owner

Owner Issue

Closes #179

Problem

The Tool layer had accumulated every responsibility in one flat Tools/ namespace. Governance control, task execution, knowledge production, and platform interfacing were interleaved with the CLI entry points that expose them, so no module had an exclusive owner, implementations were duplicated, dependency direction was unstated, legacy compatibility interfaces could not retire, and tests were organized against historical file locations rather than owned contracts.

The confirmed Tool taxonomy declared Areas and Domains that had no physical counterpart on disk. This PR makes that taxonomy the physical structure.

It is intentionally one atomic change. Moving modules without moving their entry points, imports, capability registrations, interface policy, distribution boundary, catalogs, tests, and generated projections would leave the repository unable to satisfy its own boundary checks.

Changes

Physical Area/Domain layering

Every Tool module now has exactly one Area and Domain, expressed as its location on disk:

Area Domains Modules
Tools/governance/ standards, profile, control 15
Tools/execution/ task_runtime, planning, context_delivery, evidence, audit 103
Tools/knowledge/ content, metadata, structure, rendering 29
Tools/platform/ agent_interface, distribution, repository, common 27

Tools/queue_runtime/ moved under its owner as Tools/execution/task_runtime/queue_runtime/.

Public entry surface closed

  • The top level of Tools/ now holds 63 registered entry points only — thin CLI commands, mcp_server.py, and the catalog generators.
  • Every entry is 19–50 lines (average 21) and does nothing but delegate to its owning Domain. No entry point holds logic, and none is importable as a library.
  • Baseline was 105 top-level modules mixing entries and implementations; the implementation is now 174 modules under the four Areas.

Contracts, registration, and boundaries realigned

  • Rewrote imports across the tree to the new physical paths, with import direction now explicit and checkable against the layering.
  • Updated capability registration (operation-capabilities.yaml, scan-capabilities.yaml), agent interface policy (agent-interface-policy.yaml), module boundaries (module-boundaries.yaml), test ownership (test-ownership.yaml), and the distribution boundary (distribution-boundary.yaml) to describe the layout that actually exists.
  • Updated Tools/README.md, the root README.md / README.zh-CN.md, ROADMAP.md / ROADMAP.zh-CN.md, the affected Cards, and the Kernel standards under K00, K02, K06, K08, K12, and K13.

Test system returned to its owning layer

  • Reorganized tests by the layer that owns the contract under test — 127 test modules.
  • Tools/TEST_CATALOG.md and Tools/TOOL_CATALOG.md attribute every tool and every test to its owning Area/Domain, so an unowned or orphaned test is detectable rather than invisible.
  • Bound Runner dispatch to the Tool contracts each tool actually carries, rather than to a name-based lookup.

Retired interfaces

Removed rather than kept reachable as a second authority:

Retired Kind
Tools/queue_runtime/producer_era.py producer-era compatibility shim
Tools/queue_runtime/__init__.py package-level compatibility re-export surface
Tools/migrate_standards_state.py migration bridge
Tools/schemas/component-path-migrations.yaml component-path migration bridge
Tools/apply_task_plan.py superseded implementation
Tools/batch_close_contract.py superseded implementation
Tools/coverage_contract.py, Tools/coverage_delta.py superseded implementations
Tools/audit_evidence_runtime.py superseded implementation
Tools/module_boundary_facts.py superseded implementation
Tools/queue_runtime/review.py superseded implementation

Their tests were retired with them (test_migrate_standards_state.py, test_reviewed_era_lifecycle.py, test_corpus_plan_bootstrap.py, test_json_flag_verdict_parity.py, test_stamp_cards_skeleton.py, test_template_fill.py). Old internal paths are not retained as aliases.

The last two commits close the contract gaps this exposed: planning and terminal evidence contracts, and Runner dispatch binding to carried Tool contracts.

Generated projections

Rebuilt from their canonical owners, and failing when their source contracts drift:

  • Tools/compiled/cli-contract.yaml
  • Tools/compiled/mcp-tools.json
  • Tools/compiled/metadata-execution-contract.json
  • Tools/compiled/tool-catalog.json
  • Tools/compiled/test-catalog.json
  • Tools/compiled/host-configs/

Validation

  • make check passes.
  • Catalog full test run: 1079/1079 tests, 127/127 modules pass.
  • Required Queue E2E passes.
  • Blank runtime lifecycle exercised end to end.
  • Atlas dynamic acceptance: hard cutover onto Cambium 321b530d6ccc86f1ac3d3a5a7214043594e3a929, dynamic batch close completed.
    • Atlas B001 = closed
    • runtime errors = 0
    • AuditPlan 51/51 obligations closed
    • unresolved = 0

Follow-up: host-independent runner contract (990d817)

The first CI run failed verify check: the runner's --python argument defaulted to sys.executable, freezing the generating machine's absolute interpreter path into Tools/compiled/cli-contract.yaml, so the projection could never verify as current on another host. 990d817 declares the default as None, resolves the current interpreter at dispatch time, and rebinds the interface and host-config projections. make check and the full catalog run (1079/1079, 127/127) pass against the corrected contract.

KimGLee and others added 5 commits August 29, 2026 15:15
The runner's --python argument defaulted to sys.executable, so the
compiled CLI contract froze the absolute interpreter path of whichever
machine generated it, and the projection could never verify as current
on any other host. Default to None in the declared contract and resolve
the current interpreter at dispatch time, then rebind the downstream
interface and host-config projections to the corrected contract.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@KimGLee
KimGLee merged commit 78868d0 into main Sep 1, 2026
24 checks passed
@KimGLee
KimGLee deleted the refactor/tool-runtime-layering branch September 1, 2026 05:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tool responsibilities, entry points, and legacy interfaces have collapsed into one flat namespace

1 participant