opencode-matrixx 2.5.0 → 2.6.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 (151) hide show
  1. package/README.md +184 -8
  2. package/dist/agents/dynamic-agent-prompt-builder.d.ts +3 -0
  3. package/dist/cli/doctor/checks/auth.d.ts +2 -0
  4. package/dist/cli/doctor/checks/config.d.ts +2 -0
  5. package/dist/cli/doctor/checks/context-mode.d.ts +2 -0
  6. package/dist/cli/doctor/checks/dcp.d.ts +2 -0
  7. package/dist/cli/doctor/checks/docker.d.ts +2 -0
  8. package/dist/cli/doctor/checks/headroom.d.ts +2 -0
  9. package/dist/cli/doctor/checks/helpers.d.ts +2 -0
  10. package/dist/cli/doctor/checks/index.d.ts +16 -0
  11. package/dist/cli/doctor/checks/mcp.d.ts +2 -0
  12. package/dist/cli/doctor/checks/optional.d.ts +2 -0
  13. package/dist/cli/doctor/checks/plugin.d.ts +2 -0
  14. package/dist/cli/doctor/checks/rtk.d.ts +2 -0
  15. package/dist/cli/doctor/checks/runtime.d.ts +2 -0
  16. package/dist/cli/doctor/checks/tmux.d.ts +2 -0
  17. package/dist/cli/doctor/format.d.ts +3 -0
  18. package/dist/cli/doctor/index.d.ts +9 -0
  19. package/dist/cli/doctor/types.d.ts +24 -0
  20. package/dist/cli/index.d.ts +14 -0
  21. package/dist/cli/install/index.d.ts +12 -0
  22. package/dist/cli/setup/config-writer.d.ts +12 -0
  23. package/dist/cli/setup/config-writer.test.d.ts +1 -0
  24. package/dist/cli/setup/constants.d.ts +8 -0
  25. package/dist/cli/setup/deps.d.ts +8 -0
  26. package/dist/cli/setup/deps.test.d.ts +1 -0
  27. package/dist/cli/setup/index.d.ts +8 -0
  28. package/dist/cli/setup/index.test.d.ts +1 -0
  29. package/dist/cli/setup/opencode-sync.d.ts +9 -0
  30. package/dist/cli/setup/opencode-sync.test.d.ts +1 -0
  31. package/dist/cli/setup/prompts.d.ts +4 -0
  32. package/dist/cli/setup/prompts.test.d.ts +1 -0
  33. package/dist/cli/setup/types.d.ts +26 -0
  34. package/dist/cli.js +18983 -0
  35. package/dist/config/index.d.ts +1 -1
  36. package/dist/config/schema/evolution.d.ts +89 -0
  37. package/dist/config/schema/experimental.d.ts +1 -1
  38. package/dist/config/schema/headroom.d.ts +23 -0
  39. package/dist/config/schema/hooks.d.ts +7 -1
  40. package/dist/config/schema/matrixx-config.d.ts +60 -8
  41. package/dist/config/schema/morpheus.d.ts +8 -0
  42. package/dist/config/schema.d.ts +3 -3
  43. package/dist/create-hooks.d.ts +6 -1
  44. package/dist/features/background-agent/error-helpers.d.ts +0 -2
  45. package/dist/features/builtin-commands/templates/cleanup-tasks.d.ts +1 -0
  46. package/dist/features/builtin-commands/templates/evolution.d.ts +1 -0
  47. package/dist/features/builtin-commands/templates/task-list.d.ts +1 -0
  48. package/dist/features/builtin-commands/types.d.ts +1 -1
  49. package/dist/features/evolution/compressor/index.d.ts +5 -0
  50. package/dist/features/evolution/compressor/interface.d.ts +5 -0
  51. package/dist/features/evolution/compressor/llm.d.ts +12 -0
  52. package/dist/features/evolution/evaluator.d.ts +11 -0
  53. package/dist/features/evolution/index.d.ts +7 -0
  54. package/dist/features/evolution/pipeline.d.ts +7 -0
  55. package/dist/features/evolution/store.d.ts +22 -0
  56. package/dist/features/evolution/types.d.ts +51 -0
  57. package/dist/features/evolution/writer.d.ts +20 -0
  58. package/dist/features/task-storage/storage.d.ts +12 -2
  59. package/dist/features/task-storage/types.d.ts +3 -2
  60. package/dist/features/task-toast-manager/types.d.ts +2 -2
  61. package/dist/hooks/anthropic-context-window-limit-recovery/message-builder.d.ts +0 -1
  62. package/dist/hooks/anthropic-context-window-limit-recovery/tool-part-types.d.ts +2 -1
  63. package/dist/hooks/compaction-todo-preserver/hook.d.ts +13 -0
  64. package/dist/hooks/compaction-todo-preserver/index.d.ts +1 -1
  65. package/dist/hooks/evolution-compressor/index.d.ts +15 -0
  66. package/dist/hooks/evolution-hitl/index.d.ts +12 -0
  67. package/dist/hooks/evolution-quality-gate/index.d.ts +6 -0
  68. package/dist/hooks/evolution-watcher/index.d.ts +21 -0
  69. package/dist/hooks/evolution-watcher/utils.d.ts +5 -0
  70. package/dist/hooks/index.d.ts +7 -1
  71. package/dist/hooks/keyword-detector/analyze/default.d.ts +1 -1
  72. package/dist/hooks/keyword-detector/constants.d.ts +1 -1
  73. package/dist/hooks/keyword-detector/search/default.d.ts +1 -1
  74. package/dist/hooks/keyword-detector/ultrawork/deepseek.d.ts +16 -0
  75. package/dist/hooks/keyword-detector/ultrawork/default.d.ts +5 -2
  76. package/dist/hooks/keyword-detector/ultrawork/gemini.d.ts +12 -0
  77. package/dist/hooks/keyword-detector/ultrawork/glm.d.ts +11 -0
  78. package/dist/hooks/keyword-detector/ultrawork/gpt5.2.d.ts +4 -7
  79. package/dist/hooks/keyword-detector/ultrawork/index.d.ts +11 -3
  80. package/dist/hooks/keyword-detector/ultrawork/mimo.d.ts +16 -0
  81. package/dist/hooks/keyword-detector/ultrawork/source-detector.d.ts +17 -5
  82. package/dist/hooks/matrix-loop/with-timeout.d.ts +1 -1
  83. package/dist/hooks/mcp-startup-notification/index.d.ts +9 -0
  84. package/dist/hooks/session-recovery/types.d.ts +2 -1
  85. package/dist/hooks/task-continuation-enforcer/abort-detection.d.ts +4 -0
  86. package/dist/hooks/task-continuation-enforcer/constants.d.ts +10 -0
  87. package/dist/hooks/task-continuation-enforcer/continuation-injection.d.ts +12 -0
  88. package/dist/hooks/task-continuation-enforcer/countdown.d.ts +14 -0
  89. package/dist/hooks/task-continuation-enforcer/handler.d.ts +16 -0
  90. package/dist/hooks/task-continuation-enforcer/idle-event.d.ts +11 -0
  91. package/dist/hooks/task-continuation-enforcer/index.d.ts +6 -0
  92. package/dist/hooks/task-continuation-enforcer/message-directory.d.ts +1 -0
  93. package/dist/hooks/task-continuation-enforcer/non-idle-events.d.ts +6 -0
  94. package/dist/hooks/task-continuation-enforcer/session-state.d.ts +10 -0
  95. package/dist/hooks/task-continuation-enforcer/todo.d.ts +5 -0
  96. package/dist/hooks/task-continuation-enforcer/types.d.ts +60 -0
  97. package/dist/hooks/task-edit-guard/constants.d.ts +2 -0
  98. package/dist/hooks/task-edit-guard/hook.d.ts +2 -0
  99. package/dist/hooks/task-edit-guard/index.d.ts +2 -0
  100. package/dist/hooks/think-mode/types.d.ts +3 -0
  101. package/dist/index.js +9302 -6408
  102. package/dist/matrixx.schema.json +5425 -0
  103. package/dist/mcp/index.d.ts +10 -1
  104. package/dist/mcp/mcp-startup-state.d.ts +4 -0
  105. package/dist/mcp/mcp-validator.d.ts +13 -0
  106. package/dist/plugin/hooks/create-continuation-hooks.d.ts +4 -1
  107. package/dist/plugin/hooks/create-core-hooks.d.ts +3 -1
  108. package/dist/plugin/hooks/create-session-hooks.d.ts +2 -1
  109. package/dist/plugin/hooks/create-tool-guard-hooks.d.ts +3 -2
  110. package/dist/plugin-handlers/agent-config-handler.d.ts +1 -0
  111. package/dist/shared/delay.d.ts +1 -0
  112. package/dist/shared/error-formatting.d.ts +1 -0
  113. package/dist/shared/format-bytes.d.ts +1 -0
  114. package/dist/shared/format-bytes.test.d.ts +1 -0
  115. package/dist/shared/index.d.ts +7 -9
  116. package/dist/shared/is-abort-error.test.d.ts +1 -0
  117. package/dist/shared/model-resolution-pipeline.d.ts +26 -1
  118. package/dist/shared/opencode-config-dir.d.ts +13 -2
  119. package/dist/shared/sentinels.d.ts +2 -0
  120. package/dist/shared/session-state.d.ts +15 -0
  121. package/dist/shared/status-types.d.ts +1 -0
  122. package/dist/shared/system-directive.d.ts +1 -0
  123. package/dist/shared/task-system-gating.d.ts +3 -0
  124. package/dist/shared/task-system-gating.test.d.ts +1 -0
  125. package/dist/shared/with-timeout.d.ts +1 -0
  126. package/dist/shared/with-timeout.test.d.ts +1 -0
  127. package/dist/tools/background-task/delay.d.ts +1 -1
  128. package/dist/tools/index.d.ts +2 -1
  129. package/dist/tools/pdf-extract-figures/index.d.ts +1 -0
  130. package/dist/tools/pdf-extract-figures/tools.d.ts +11 -0
  131. package/dist/tools/task/index.d.ts +1 -1
  132. package/dist/tools/task/task-cleanup.d.ts +4 -0
  133. package/dist/tools/task/task-cleanup.test.d.ts +1 -0
  134. package/dist/tools/task/task-get.d.ts +2 -1
  135. package/dist/tools/task/task-list.d.ts +2 -1
  136. package/dist/tools/task/types.d.ts +7 -5
  137. package/package.json +16 -4
  138. package/dist/config/schema/model-capabilities.d.ts +0 -8
  139. package/dist/hooks/runtime-fallback/is-abort-error.d.ts +0 -1
  140. package/dist/hooks/todo-description-override/description.d.ts +0 -1
  141. package/dist/hooks/todo-description-override/hook.d.ts +0 -8
  142. package/dist/hooks/todo-description-override/index.d.ts +0 -1
  143. package/dist/shared/is-object.d.ts +0 -1
  144. package/dist/shared/model-resolution-types.d.ts +0 -27
  145. package/dist/shared/model-resolver.d.ts +0 -24
  146. package/dist/shared/opencode-config-dir-types.d.ts +0 -13
  147. package/dist/shared/session-model-state.d.ts +0 -6
  148. package/dist/shared/session-temperature-store.d.ts +0 -3
  149. package/dist/shared/session-tools-store.d.ts +0 -3
  150. package/dist/tools/task/todo-sync.d.ts +0 -16
  151. /package/dist/{hooks/architect → shared}/is-abort-error.d.ts +0 -0
package/README.md CHANGED
@@ -61,12 +61,34 @@ That's it. Parallel agents, background tasks, deep exploration, relentless execu
61
61
 
62
62
  ## Quick Start
63
63
 
64
- ### Install
64
+ ### Prerequisites
65
+
66
+ - **Bun** 1.4.0 — `curl -fsSL https://bun.sh/install | bash`
67
+ - **OpenCode** ≥ 1.0.150 — https://opencode.ai/docs
68
+ - Verify: `bun --version && opencode --version`
69
+
70
+ ### Install (Recommended)
71
+
72
+ ```bash
73
+ bunx opencode-matrixx install
74
+ ```
75
+
76
+ Or for non-interactive setup (CI/agents):
77
+
78
+ ```bash
79
+ bunx opencode-matrixx install --no-tui --claude=yes --openai=yes --gemini=no --copilot=no
80
+ ```
81
+
82
+ ### Verify Installation
65
83
 
66
84
  ```bash
67
- npm install -g opencode-matrixx
85
+ bunx opencode-matrixx doctor
86
+ # No "fail" = good. "warn" for missing optional providers is expected.
87
+ # If doctor reports auth failures after login, update to latest: bunx opencode-matrixx@latest doctor
68
88
  ```
69
89
 
90
+ Troubleshooting installation issues? See [Installation guide →](docs/guide/installation.md#troubleshooting).
91
+
70
92
  ### Configure
71
93
 
72
94
  Create `matrixx.jsonc` in your project root:
@@ -78,6 +100,16 @@ Create `matrixx.jsonc` in your project root:
78
100
  }
79
101
  ```
80
102
 
103
+ > **Full example:** See [`matrixx.example.jsonc`](./matrixx.example.jsonc) — a fully annotated reference covering every configuration parameter (agents, categories, **headroom**, **context-mode** (external), DCP, RTK, security, tmux, assembly, evolution, and more) with inline comments and defaults. Copy the sections you need into your project `.opencode/matrixx.jsonc` or user `~/.config/opencode/matrixx.jsonc` (both support JSONC comments).
104
+ > Full guide: [Configuration →](docs/configurations.md) · [Context Management (5 layers) →](docs/context-management.md)
105
+
106
+ ### Authenticate
107
+
108
+ ```bash
109
+ opencode auth login # follow prompts for each provider you have
110
+ bunx opencode-matrixx doctor --category authentication # verify
111
+ ```
112
+
81
113
  ### Use
82
114
 
83
115
  Open OpenCode and start coding. Matrixx activates automatically.
@@ -89,12 +121,33 @@ Install and configure matrixx by following the instructions here:
89
121
  https://raw.githubusercontent.com/klpanagi/opencode-matrixx/refs/heads/dev/docs/guide/installation.md
90
122
  ```
91
123
 
92
- [Manual installation guide →](docs/guide/installation.md) · [Uninstall →](docs/guide/uninstallation.md)
124
+ [Installation guide →](docs/guide/installation.md) . [Uninstall →](docs/guide/uninstallation.md) . [CLI reference →](docs/cli-guide.md)
93
125
 
94
126
  ---
95
127
 
96
- ---
128
+ ## CLI Reference
129
+
130
+ Matrixx includes a built-in CLI accessible via `bunx opencode-matrixx <command>`:
131
+
132
+ | Command | Description |
133
+ |---------|-------------|
134
+ | `install` | Interactive setup wizard (or `--no-tui` for CI/CD) |
135
+ | `doctor` | Environment diagnostics and health checks |
136
+ | `version` | Display version information |
97
137
 
138
+ ### Doctor Checks
139
+
140
+ | Category | What It Checks |
141
+ |----------|----------------|
142
+ | installation | Plugin registration, OpenCode version |
143
+ | configuration | Config file validity (matrixx.jsonc) |
144
+ | authentication | Provider API key status (Anthropic, OpenAI, Google) |
145
+ | dependencies | Runtime deps: Bun, Node.js, Git, Python3 |
146
+ | tools | Optional: ast-grep, Gitleaks, PyMuPDF, Playwright |
147
+
148
+ Use `--json` for machine-readable output or `--category <name>` for a specific check.
149
+
150
+ ---
98
151
  ## The Agent Team
99
152
 
100
153
  ### 01. Morpheus — *The Orchestrator*
@@ -302,7 +355,7 @@ Every agent, model, temperature, and permission is fully customizable. [**Meet t
302
355
 
303
356
  | | |
304
357
  |---|---|
305
- || **Agent Orchestration** | 15 agents (incl. **Mouse** dedicated executor, **Sati** frontend specialist, **Sentinel** security auditor, **Cipher** DSL expert), parallel background execution, category-based routing, session continuity |
358
+ | **Agent Orchestration** | 15 agents (incl. **Mouse** dedicated executor, **Sati** frontend specialist, **Sentinel** security auditor, **Cipher** DSL expert), parallel background execution, category-based routing, session continuity |
306
359
  | **Developer Tools** | LSP (goto def, rename, diagnostics), AST-Grep (search & replace), Tmux terminal |
307
360
  | **~52 Lifecycle Hooks** | Context injection, think mode, comment checking, todo enforcement, error recovery, quality gate |
308
361
  || **33 Built-in Skills** | DSL engineering (11), security (9), browser, git, frontend (7 via **Sati**), saturation research, AI slop detection, software dev pipeline |
@@ -311,7 +364,8 @@ Every agent, model, temperature, and permission is fully customizable. [**Meet t
311
364
  | **Software Dev Pipeline** | 6-phase TDD workflow (PLAN→BUILD→VERIFY→REVIEW→SECURE→SHIP), 5 team roles, adaptive phases |
312
365
  ||| **Assembly Tool** | Multi-model debate that spawns 3-5 parallel voters from different providers, collects independent reasoning, and synthesizes unified decisions with confidence scoring |
313
366
  || **Saturation Research** | Multi-round (/research) spawning parallel explore/librarian swarms across code, docs, web, and OSS with adaptive novelty-based convergence (max 5 rounds) |
314
- || **AI Slop Detection** | remove-ai-slops skill detects and removes 7 categories of AI-generated code smells — verbose comments, redundant error handling, over-engineered patterns, generic AI phrasing, cargo-cult boilerplate |
367
+ | **AI Slop Detection** | remove-ai-slops skill detects and removes 7 categories of AI-generated code smells — verbose comments, redundant error handling, over-engineered patterns, generic AI phrasing, cargo-cult boilerplate |
368
+ | **Context Management (L0-L4)** | 5-layer stack: Native + [RTK](https://github.com/rtk-ai/rtk) + [context-mode](https://github.com/tarquinen/context-mode) + [DCP](https://github.com/tarquinen/opencode-dcp) + [Headroom](https://github.com/headroomlabs-ai/headroom) — zero overlap, <10ms Matrixx bridge, 60-95% JSON via `CacheAligner→CCR` |
315
369
 
316
370
  [**Full feature list →**](docs/features.md) · [**Configuration guide →**](docs/configurations.md) · [**Architecture diagram →**](docs/agent-architecture.md)
317
371
 
@@ -476,6 +530,128 @@ The 10-20ms subprocess overhead is negligible compared to command execution time
476
530
 
477
531
  ---
478
532
 
533
+ ## Headroom Integration — Network-Proxy Compression
534
+
535
+ > **Deep dive:** [Context Management → 2.4 Headroom](docs/context-management.md#24-headroom--network-proxy-compression) — full 5-layer guide with config reference, verification and troubleshooting.
536
+
537
+ Matrixx integrates [Headroom](https://github.com/headroomlabs-ai/headroom) for network-proxy-level token compression, reducing context by **60-95%** on JSON, **15-20%** on coding agents via `CacheAligner→ContentRouter→CCR` pipeline.
538
+
539
+ ### What is Headroom?
540
+
541
+ Headroom is a proxy + MCP provider that compresses history before it reaches the LLM. It intercepts the OpenAI-compatible provider `headroom` via `@ai-sdk/openai-compatible` and serves retrieval via `headroom_retrieve`.
542
+
543
+ ```
544
+ # Without headroom: 50k tokens history
545
+ # Every turn ships full JSON + tool outputs
546
+
547
+ # With headroom wrap: 8k tokens (CCR + retrieval)
548
+ $ headroom wrap opencode
549
+ # CCR compresses; agents retrieve via headroom_retrieve on demand
550
+ ```
551
+
552
+ Headroom is ideal for JSON-heavy sessions, long histories, and multi-project reuse where the same compressed context (CCR) can be shared.
553
+
554
+ ### How It Works
555
+
556
+ 1. User runs `headroom wrap opencode` (starts proxy at `http://127.0.0.1:8787`)
557
+ 2. Headroom MCP registers `headroom_retrieve` / `headroom_stats`
558
+ 3. Matrixx detects `hasHeadroom = availableTools.some(t => t.name.startsWith("headroom_"))` and injects Headroom discipline into agent prompts
559
+ 4. Proxy's `CacheAligner→ContentRouter→CCR` compresses; agents retrieve via `headroom_retrieve` on demand
560
+
561
+ Matrixx does not vendor Headroom. It provides a thin config bridge in `src/config/schema/headroom.ts` plus runtime detection. Native transport `headroom-opencode` is deferred to Phase 2.
562
+
563
+ ### Configuration
564
+
565
+ Headroom is **disabled by default** (opt-in). Enable it in `matrixx.jsonc`:
566
+
567
+ ```jsonc
568
+ {
569
+ "$schema": "https://raw.githubusercontent.com/klpanagi/opencode-matrixx/refs/heads/dev/dist/matrixx.schema.json",
570
+ "headroom": {
571
+ "enabled": true, // default: false — opt-in
572
+ "proxyUrl": "http://127.0.0.1:8787", // optional — defaults to proxy default
573
+ "project": "my-project", // optional — CCR scoping
574
+ "backend": "openai" // optional — HEADROOM_BACKEND
575
+ }
576
+ }
577
+ ```
578
+
579
+ | Option | Type | Default | Notes |
580
+ |--------|------|---------|-------|
581
+ | `enabled` | boolean | `false` | Opt-in — no proxy/discipline unless `true` |
582
+ | `proxyUrl` | string (url) | `http://127.0.0.1:8787` | Proxy URL (`HEADROOM_PROXY_URL` override) |
583
+ | `project` | string | `undefined` | CCR scoping per project |
584
+ | `backend` | string | `undefined` | Maps to `HEADROOM_BACKEND` |
585
+
586
+ ### Installation
587
+
588
+ Install Headroom from [headroomlabs-ai/headroom](https://github.com/headroomlabs-ai/headroom):
589
+
590
+ ```bash
591
+ # Install (pick one)
592
+ uv tool install headroom-ai[all]
593
+ # or
594
+ pipx install headroom-ai[all]
595
+
596
+ # Verify
597
+ headroom --version
598
+ headroom doctor
599
+
600
+ # Run via proxy (recommended)
601
+ headroom wrap opencode
602
+ # alternative — env wrapping
603
+ # HEADROOM_WRAP=1 headroom wrap -- opencode
604
+
605
+ # Dashboard
606
+ headroom dashboard
607
+ ```
608
+
609
+ Package versions: `npm: headroom-ai@0.37.0`, `PyPI: headroom-ai[all]`. Docs at [headroom-docs.vercel.app](https://headroom-docs.vercel.app).
610
+
611
+ > **Note:** Native TypeScript plugin `headroom-opencode` is deferred to **Phase 2** due to [#2798](https://github.com/sst/opencode/issues/2798) global `fetch` patch collision and [#76](https://github.com/headroomlabs-ai/headroom/issues/76) compaction not yet stable. Prefer `wrap` for now.
612
+
613
+ ### Verification
614
+
615
+ After install, confirm Matrixx sees Headroom:
616
+
617
+ ```bash
618
+ headroom doctor # proxy health
619
+ headroom wrap opencode # should show: proxy http://127.0.0.1:8787
620
+ ```
621
+
622
+ - In OpenCode TUI, run `headroom_stats` (or `headroom dashboard`) — if the tool is listed, Matrixx injected Headroom discipline into Morpheus/Keymaker prompts.
623
+ - Agents will use `headroom_retrieve` / `headroom_search` automatically — you don't call them manually. If `headroom_*` tools are absent, check `matrixx.jsonc` has `headroom.enabled: true` and restart OpenCode.
624
+
625
+ ### Usage
626
+
627
+ No code changes needed. Once `headroom wrap opencode` is running and `headroom.enabled: true`:
628
+
629
+ - **You** keep using OpenCode normally (`ultrawork`, etc.).
630
+ - **Proxy** compresses history out-of-process via `CacheAligner→ContentRouter→CCR` before it reaches the LLM.
631
+ - **Agents** retrieve compressed slices on demand via `headroom_retrieve` (never re-read full history) and check stats via `headroom_stats`.
632
+ - **CCR** is shared across projects — ideal for repeated JSON-heavy sessions.
633
+
634
+ To disable, set `headroom.enabled: false` or run OpenCode without `headroom wrap`.
635
+
636
+ ### Performance Impact
637
+
638
+ | Metric | Value |
639
+ |--------|-------|
640
+ | **Matrixx bridge overhead** | ~0ms (prompt-only; proxy out-of-process) |
641
+ | **Proxy token savings** | 60-95% JSON, 15-20% coding agents |
642
+ | **Complementarity** | L4 orthogonal to L1 RTK + L2 context-mode + L3 DCP + L0 native (zero overlap) |
643
+ | **Net benefit** | Retrieval-on-demand reduces per-turn context; CCR shared across projects |
644
+
645
+ ### 5-Layer Complementarity
646
+
647
+ | Layer | Owner | Mechanism | Reduction |
648
+ |-------|-------|-----------|-----------|
649
+ | L0 Native | Matrixx | 70% warn, preemptive-compaction, anthropic-recovery | Prevents OOM |
650
+ | L1 RTK | RTK hook | Bash output compression | 60-90% bash |
651
+ | L2 context-mode | context-mode plugin | FTS5 sandbox `ctx_*` | 98% sandbox |
652
+ | L3 DCP | `@tarquinen/opencode-dcp` | Pruning tiers `economy→ultimate` | Tiered pruning |
653
+ | L4 Headroom | headroom proxy | `CacheAligner→ContentRouter→CCR` | 60-95% JSON |
654
+ ---
479
655
 
480
656
  ## Documentation
481
657
 
@@ -488,11 +664,11 @@ The 10-20ms subprocess overhead is negligible compared to command execution time
488
664
  | [Configuration](docs/configurations.md) | All config options, agent overrides, hooks, categories |
489
665
  | [Orchestration](docs/orchestration-guide.md) | How agents coordinate, delegate, and recover |
490
666
  | [Categories & Skills](docs/category-skill-guide.md) | Task categories, skill injection, delegation patterns |
667
+ | [Context Management](docs/context-management.md) | 5-layer context stack (Native, RTK, context-mode, DCP, Headroom) — setup, config, verification |
491
668
 
492
669
  ---
493
670
 
494
- If this saves you time, a ⭐ goes a long way.
495
671
 
496
- **Curious about the philosophy?** Read the [Ultrawork Manifesto](docs/ultrawork-manifesto.md) — originally authored by [code-yeongyu](https://github.com/code-yeongyu), the creator of oh-my-opencode.
672
+ If this saves you time, a ⭐ goes a long way.
497
673
 
498
674
  <sub>Productivity might spike too hard. Don't let your coworker notice. Actually — let's see who wins.</sub>
@@ -34,4 +34,7 @@ export declare function buildOracleSection(agents: AvailableAgent[]): string;
34
34
  export declare function buildHardBlocksSection(): string;
35
35
  export declare function buildAntiPatternsSection(): string;
36
36
  export declare function buildContextDisciplineSection(hasContextMode?: boolean): string;
37
+ export declare function buildHeadroomSection(hasHeadroom?: boolean): string;
38
+ export declare function buildCompactContextDisciplineSection(hasContextMode?: boolean): string;
39
+ export declare function buildExploreDisciplineSection(hasContextMode?: boolean, hasHeadroom?: boolean): string;
37
40
  export declare function buildUltraworkSection(agents: AvailableAgent[], categories: AvailableCategory[], skills: AvailableSkill[]): string;
@@ -0,0 +1,2 @@
1
+ import type { DoctorCheck } from "../types";
2
+ export declare const authCheck: DoctorCheck;
@@ -0,0 +1,2 @@
1
+ import type { DoctorCheck } from "../types";
2
+ export declare const configValidationCheck: DoctorCheck;
@@ -0,0 +1,2 @@
1
+ import type { DoctorCheck } from "../types";
2
+ export declare const contextModeCheck: DoctorCheck;
@@ -0,0 +1,2 @@
1
+ import type { DoctorCheck } from "../types";
2
+ export declare const dcpCheck: DoctorCheck;
@@ -0,0 +1,2 @@
1
+ import type { DoctorCheck } from "../types";
2
+ export declare const dockerCheck: DoctorCheck;
@@ -0,0 +1,2 @@
1
+ import type { DoctorCheck } from "../types";
2
+ export declare const headroomCheck: DoctorCheck;
@@ -0,0 +1,2 @@
1
+ export declare function readMatrixxConfig(): Record<string, unknown> | null;
2
+ export declare function getNested<T>(obj: Record<string, unknown> | null, path: string): T | undefined;
@@ -0,0 +1,16 @@
1
+ import type { DoctorCheck } from "../types";
2
+ export declare const ALL_CHECKS: DoctorCheck[];
3
+ export declare function getChecksByCategory(category: string): DoctorCheck[];
4
+ export declare function getCategories(): string[];
5
+ export { authCheck } from "./auth";
6
+ export { configValidationCheck } from "./config";
7
+ export { contextModeCheck } from "./context-mode";
8
+ export { dcpCheck } from "./dcp";
9
+ export { dockerCheck } from "./docker";
10
+ export { headroomCheck } from "./headroom";
11
+ export { mcpPrerequisitesCheck } from "./mcp";
12
+ export { optionalToolsCheck } from "./optional";
13
+ export { pluginInstallationCheck } from "./plugin";
14
+ export { rtkCheck } from "./rtk";
15
+ export { runtimeDepsCheck } from "./runtime";
16
+ export { tmuxCheck } from "./tmux";
@@ -0,0 +1,2 @@
1
+ import type { DoctorCheck } from "../types";
2
+ export declare const mcpPrerequisitesCheck: DoctorCheck;
@@ -0,0 +1,2 @@
1
+ import type { DoctorCheck } from "../types";
2
+ export declare const optionalToolsCheck: DoctorCheck;
@@ -0,0 +1,2 @@
1
+ import type { DoctorCheck } from "../types";
2
+ export declare const pluginInstallationCheck: DoctorCheck;
@@ -0,0 +1,2 @@
1
+ import type { DoctorCheck } from "../types";
2
+ export declare const rtkCheck: DoctorCheck;
@@ -0,0 +1,2 @@
1
+ import type { DoctorCheck } from "../types";
2
+ export declare const runtimeDepsCheck: DoctorCheck;
@@ -0,0 +1,2 @@
1
+ import type { DoctorCheck } from "../types";
2
+ export declare const tmuxCheck: DoctorCheck;
@@ -0,0 +1,3 @@
1
+ import type { DoctorReport } from "./types";
2
+ export declare function formatDoctorReport(report: DoctorReport): string;
3
+ export declare function formatDoctorJson(report: DoctorReport): string;
@@ -0,0 +1,9 @@
1
+ import type { DoctorReport } from "./types";
2
+ export type { CheckCategory, CheckResult, CheckStatus, DoctorCheck, DoctorReport } from "./types";
3
+ export interface DoctorOptions {
4
+ category?: string;
5
+ json?: boolean;
6
+ }
7
+ export declare function runDoctor(options?: DoctorOptions): Promise<DoctorReport>;
8
+ export declare function executeDoctor(options?: DoctorOptions): Promise<string>;
9
+ export { ALL_CHECKS, getCategories, getChecksByCategory } from "./checks";
@@ -0,0 +1,24 @@
1
+ export type CheckStatus = "pass" | "warn" | "fail";
2
+ export interface CheckResult {
3
+ name: string;
4
+ status: CheckStatus;
5
+ message: string;
6
+ category?: string;
7
+ detail?: string;
8
+ }
9
+ export type CheckCategory = "installation" | "configuration" | "authentication" | "dependencies" | "tools" | "integrations" | "updates";
10
+ export interface DoctorCheck {
11
+ name: string;
12
+ category: CheckCategory;
13
+ check: () => Promise<CheckResult> | CheckResult;
14
+ }
15
+ export interface DoctorReport {
16
+ timestamp: string;
17
+ checks: CheckResult[];
18
+ summary: {
19
+ total: number;
20
+ passed: number;
21
+ warnings: number;
22
+ failed: number;
23
+ };
24
+ }
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env bun
2
+ /**
3
+ * Matrixx CLI — `bunx opencode-matrixx <command>`
4
+ *
5
+ * Commands:
6
+ * doctor - Environment diagnostics and health checks
7
+ * install - Interactive setup wizard (--no-tui for CI)
8
+ * setup - Standalone setup wizard for deps + matrixx.jsonc generation
9
+ * version - Display version information
10
+ * help - Display help information
11
+ */
12
+ declare function main(): Promise<void>;
13
+ export { main };
14
+ export default main;
@@ -0,0 +1,12 @@
1
+ export interface InstallOptions {
2
+ noTui?: boolean;
3
+ claude?: "yes" | "no" | "max20";
4
+ openai?: "yes" | "no";
5
+ gemini?: "yes" | "no";
6
+ copilot?: "yes" | "no";
7
+ opencodeZen?: "yes" | "no";
8
+ zaiCodingPlan?: "yes" | "no";
9
+ verbose?: boolean;
10
+ local?: boolean;
11
+ }
12
+ export declare function executeInstall(options: InstallOptions): Promise<string>;
@@ -0,0 +1,12 @@
1
+ import { type MatrixxConfig } from "../../config/schema/matrixx-config";
2
+ import type { SetupState } from "./types";
3
+ export declare function resolveMatrixxConfigPath(): {
4
+ format: "json" | "jsonc" | "none";
5
+ path: string;
6
+ };
7
+ export declare function buildMatrixxConfig(state: SetupState, existing: MatrixxConfig | null): MatrixxConfig;
8
+ export declare function previewDiff(existing: string, next: string): string;
9
+ export declare function writeMatrixxConfig(targetPath: string, config: MatrixxConfig, opts: {
10
+ dryRun: boolean;
11
+ backup: boolean;
12
+ }): Promise<void>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,8 @@
1
+ import type { Platform } from "./types";
2
+ export declare const REQUIRED_DEPS: readonly ["bun", "opencode", "git"];
3
+ export declare const OPTIONAL_DEPS: readonly ["headroom", "rtk", "dcp", "gitleaks", "ast-grep", "playwright"];
4
+ export type InstallCommandMap = Record<string, Record<Platform | "all", string> | Record<string, string>>;
5
+ export declare const PLATFORM_INSTALL_COMMANDS: Record<string, Partial<Record<Platform | "all", string>>>;
6
+ export declare function getDcpInstallHint(): string;
7
+ export declare function configDirHint(): string;
8
+ export declare function dcpPluginDirHint(): string;
@@ -0,0 +1,8 @@
1
+ import { type DepStatus, type Platform } from "./types";
2
+ export declare function isBunVersionOk(found: string): boolean;
3
+ export declare function isOpenCodeVersionOk(found: string): boolean;
4
+ export declare function getPlatform(): Platform;
5
+ export declare function getInstallCommand(dep: string, platform: Platform): string;
6
+ export declare function checkRequiredDeps(): DepStatus[];
7
+ export declare function checkOptionalDeps(): DepStatus[];
8
+ export declare function formatDepReport(statuses: DepStatus[]): string;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,8 @@
1
+ export { PLATFORM_INSTALL_COMMANDS } from "./constants";
2
+ export { checkOptionalDeps, checkRequiredDeps, formatDepReport, getInstallCommand, getPlatform, isBunVersionOk, isOpenCodeVersionOk } from "./deps";
3
+ export { runSetupPrompts } from "./prompts";
4
+ export type { DepStatus, Platform, SetupState } from "./types";
5
+ export declare function executeSetup(opts: {
6
+ dryRun: boolean;
7
+ yes: boolean;
8
+ }): Promise<string>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,9 @@
1
+ import type { SetupState } from "./types";
2
+ export declare function resolveOpencodeConfigPath(): {
3
+ format: "json" | "jsonc" | "none";
4
+ path: string;
5
+ };
6
+ export declare function syncOpencodePlugins(state: SetupState, opts: {
7
+ dryRun: boolean;
8
+ }): Promise<void>;
9
+ export declare function hasContextModePlugin(plugins: string[]): boolean;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,4 @@
1
+ import type { DepStatus, SetupState } from "./types";
2
+ export declare function runSetupPrompts(deps: DepStatus[], opts: {
3
+ yes: boolean;
4
+ }): Promise<SetupState>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,26 @@
1
+ export type Platform = "darwin" | "linux" | "win32";
2
+ export type DepStatus = {
3
+ name: string;
4
+ required: boolean;
5
+ found: boolean;
6
+ version?: string;
7
+ installHint: string;
8
+ };
9
+ export type SetupState = {
10
+ taskSystem: boolean;
11
+ headroom: {
12
+ enabled: boolean;
13
+ proxyUrl?: string;
14
+ project?: string;
15
+ };
16
+ rtk: {
17
+ enabled: boolean;
18
+ binaryPath?: string;
19
+ };
20
+ dcp: {
21
+ enabled: boolean;
22
+ };
23
+ contextMode: boolean;
24
+ };
25
+ export declare const BUN_REQUIRED = "1.4.0";
26
+ export declare const OPENCODE_MIN = "1.0.150";