@iowarp/clio-coder 0.3.0
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 +407 -0
- package/CODE_OF_CONDUCT.md +21 -0
- package/CONTRIBUTING.md +224 -0
- package/LICENSE +202 -0
- package/NOTICE +9 -0
- package/README.md +798 -0
- package/SECURITY.md +72 -0
- package/assets/clio-coder-logo-128.webp +0 -0
- package/damage-control-rules.yaml +419 -0
- package/dist/acp-UMLFVA3F.js +92 -0
- package/dist/agents-Q4MYPMUW.js +91 -0
- package/dist/auth-O6HYIJ6J.js +521 -0
- package/dist/chunk-262G75JS.js +35 -0
- package/dist/chunk-26BZQOAD.js +1281 -0
- package/dist/chunk-2J63S4SF.js +508 -0
- package/dist/chunk-3DANZDGR.js +717 -0
- package/dist/chunk-4UQA7NCT.js +29 -0
- package/dist/chunk-527KG6XR.js +497 -0
- package/dist/chunk-5LDRNKX2.js +1063 -0
- package/dist/chunk-5N2FG33Q.js +25 -0
- package/dist/chunk-67MTHP2E.js +135 -0
- package/dist/chunk-6CWDTGUC.js +20 -0
- package/dist/chunk-7BHLZB3A.js +2115 -0
- package/dist/chunk-7RBKDI66.js +348 -0
- package/dist/chunk-AMFR5YA3.js +541 -0
- package/dist/chunk-BBUH4VAA.js +1224 -0
- package/dist/chunk-BYEU76JP.js +899 -0
- package/dist/chunk-CLJ5HLUD.js +458 -0
- package/dist/chunk-D5YD55AR.js +116 -0
- package/dist/chunk-DXQNI4PC.js +61 -0
- package/dist/chunk-E3NYWENM.js +1004 -0
- package/dist/chunk-GNGDQYDU.js +34688 -0
- package/dist/chunk-GOTUR54M.js +9 -0
- package/dist/chunk-HBU5MTAM.js +41 -0
- package/dist/chunk-HMYNFFY4.js +28 -0
- package/dist/chunk-JPOWPFCU.js +1010 -0
- package/dist/chunk-JWHCJDCI.js +1215 -0
- package/dist/chunk-KBR4MZZR.js +41 -0
- package/dist/chunk-KKKPTZLM.js +93 -0
- package/dist/chunk-ME6DNWIU.js +66 -0
- package/dist/chunk-NI4DEJMC.js +88 -0
- package/dist/chunk-O4EJEDHO.js +659 -0
- package/dist/chunk-PIDUD6M2.js +31 -0
- package/dist/chunk-PS4PFJQP.js +29459 -0
- package/dist/chunk-QV47YRF4.js +48 -0
- package/dist/chunk-RQDWMVRB.js +279 -0
- package/dist/chunk-TFSSEXL6.js +136 -0
- package/dist/chunk-TKHQ4DGZ.js +8290 -0
- package/dist/chunk-TPOCL34A.js +2876 -0
- package/dist/chunk-UGYAX5YI.js +565 -0
- package/dist/chunk-UHTSULZS.js +461 -0
- package/dist/chunk-UU3R62TT.js +128 -0
- package/dist/chunk-UWIJNAOB.js +3906 -0
- package/dist/chunk-VOO7NYPP.js +914 -0
- package/dist/chunk-VPAWTYLY.js +117 -0
- package/dist/chunk-WD6AJM35.js +1216 -0
- package/dist/chunk-X3BR7HWV.js +115 -0
- package/dist/chunk-X3NE4WVW.js +120 -0
- package/dist/chunk-XNISANGE.js +1395 -0
- package/dist/chunk-XV4ZJ6ZM.js +3177 -0
- package/dist/cli/index.js +236 -0
- package/dist/clio-KIQ5SNDS.js +53 -0
- package/dist/components-JVHMUBEB.js +653 -0
- package/dist/config-ZFCDBMDC.js +372 -0
- package/dist/configure-G4E3A2PG.js +27 -0
- package/dist/context-CDXTP2MP.js +293 -0
- package/dist/context-E3KIFVXI.js +185 -0
- package/dist/context-clear-3F4PLXOS.js +102 -0
- package/dist/context-index-Q7YSYTR3.js +106 -0
- package/dist/docs-YIETIWZI.js +280 -0
- package/dist/doctor-M5HJJZOL.js +61 -0
- package/dist/domains/agents/builtins/architect.md +33 -0
- package/dist/domains/agents/builtins/coder.md +31 -0
- package/dist/domains/agents/builtins/context-bootstrap.md +38 -0
- package/dist/domains/agents/builtins/debugger.md +30 -0
- package/dist/domains/agents/builtins/documenter.md +31 -0
- package/dist/domains/agents/builtins/git-master.md +30 -0
- package/dist/domains/agents/builtins/provenance.md +30 -0
- package/dist/domains/agents/builtins/researcher.md +71 -0
- package/dist/domains/agents/builtins/scout.md +42 -0
- package/dist/domains/agents/builtins/tester.md +31 -0
- package/dist/domains/agents/builtins/verifier.md +30 -0
- package/dist/domains/agents/builtins/wiki-writer.md +41 -0
- package/dist/eval-B3KZZESM.js +2674 -0
- package/dist/evidence-V67CHM35.js +233 -0
- package/dist/evolve-YDZSUQYA.js +518 -0
- package/dist/extensions-SRG7XCAH.js +207 -0
- package/dist/fleet-CA2CRTVG.js +760 -0
- package/dist/fleet-preflight-CLIAX7YR.js +21 -0
- package/dist/init-2OZDJE2D.js +227 -0
- package/dist/memory-3PIQQAKX.js +207 -0
- package/dist/models-DY35XI7Y.js +237 -0
- package/dist/paths-5OMXW7Z4.js +57 -0
- package/dist/preload-KZVHET2B.js +11 -0
- package/dist/reset-PIFYNOS3.js +216 -0
- package/dist/run-3VSPP24F.js +735 -0
- package/dist/share-D36RQCXM.js +241 -0
- package/dist/skills-F2MRLELY.js +445 -0
- package/dist/skills-eval-E2ZTW4PL.js +932 -0
- package/dist/targets-DZMEZAH4.js +977 -0
- package/dist/trace-7NYCUI2J.js +250 -0
- package/dist/uninstall-AD3JWHBB.js +322 -0
- package/dist/upgrade-WYYBKGDY.js +301 -0
- package/dist/usage-ULIDAGFF.js +755 -0
- package/dist/version-ROZ6CZKH.js +16 -0
- package/dist/wiki-generate-PKFIX6OB.js +377 -0
- package/dist/worker/entry.js +1739 -0
- package/docs/README.md +93 -0
- package/docs/acp.md +120 -0
- package/docs/alcf-provider.md +72 -0
- package/docs/architecture.md +172 -0
- package/docs/artifact-versions.md +54 -0
- package/docs/built-in-agents.md +265 -0
- package/docs/capacity-and-scheduling.md +97 -0
- package/docs/commands-and-modes.md +554 -0
- package/docs/config-knobs-audit.md +115 -0
- package/docs/configuration-and-targets.md +812 -0
- package/docs/context-engine.md +236 -0
- package/docs/dispatch-architecture-rationale.md +126 -0
- package/docs/documentation-coverage.md +46 -0
- package/docs/documentation-guide.md +166 -0
- package/docs/environment-variables.md +105 -0
- package/docs/eval-runner.md +205 -0
- package/docs/evals-internal.md +298 -0
- package/docs/evidence-and-memory.md +243 -0
- package/docs/evolution.md +143 -0
- package/docs/exit-codes-and-output.md +74 -0
- package/docs/extensions-and-sharing.md +306 -0
- package/docs/fleet-demo-runbook.md +179 -0
- package/docs/fleet-dispatch.md +591 -0
- package/docs/glossary.md +75 -0
- package/docs/html/agents_blueprint.html +936 -0
- package/docs/html/alcf_blueprint.html +324 -0
- package/docs/html/architecture_blueprint.html +850 -0
- package/docs/html/commands_blueprint.html +794 -0
- package/docs/html/config_knobs_audit_blueprint.html +178 -0
- package/docs/html/configuration_blueprint.html +1080 -0
- package/docs/html/context_blueprint.html +603 -0
- package/docs/html/documentation_blueprint.html +832 -0
- package/docs/html/environment_blueprint.html +404 -0
- package/docs/html/eval_blueprint.html +743 -0
- package/docs/html/evals_internal_blueprint.html +190 -0
- package/docs/html/evolution_blueprint.html +674 -0
- package/docs/html/extensions_blueprint.html +2065 -0
- package/docs/html/fleet_dispatch_blueprint.html +286 -0
- package/docs/html/index.html +919 -0
- package/docs/html/lifecycle_blueprint.html +723 -0
- package/docs/html/memory_blueprint.html +699 -0
- package/docs/html/middleware_blueprint.html +664 -0
- package/docs/html/models_blueprint.html +2366 -0
- package/docs/html/observability_blueprint.html +683 -0
- package/docs/html/provider_adapter_blueprint.html +245 -0
- package/docs/html/safety_blueprint.html +1386 -0
- package/docs/html/shared.css +571 -0
- package/docs/html/shared.js +143 -0
- package/docs/html/skills_blueprint.html +671 -0
- package/docs/html/soak_blueprint.html +182 -0
- package/docs/html/tool_usage_blueprint.html +350 -0
- package/docs/html/tools_blueprint.html +2249 -0
- package/docs/html/trace_blueprint.html +235 -0
- package/docs/html/tui_design_blueprint.html +314 -0
- package/docs/html/validation_blueprint.html +961 -0
- package/docs/html/worker_dispatch_blueprint.html +231 -0
- package/docs/installation-and-lifecycle.md +308 -0
- package/docs/middleware-and-components.md +148 -0
- package/docs/model-catalog.md +189 -0
- package/docs/observability.md +233 -0
- package/docs/proactive-memory.md +452 -0
- package/docs/prompt-envelope-and-tools.md +142 -0
- package/docs/provider-adapter-cookbook.md +148 -0
- package/docs/release-cut-checklist.md +138 -0
- package/docs/safety-model.md +357 -0
- package/docs/scientific-validation.md +105 -0
- package/docs/session-lifecycle.md +156 -0
- package/docs/skills-marketplace.md +46 -0
- package/docs/tool-usage.md +527 -0
- package/docs/trace-store.md +132 -0
- package/docs/troubleshooting.md +33 -0
- package/docs/tui-design.md +239 -0
- package/docs/worker-dispatch-mechanics.md +242 -0
- package/package.json +132 -0
- package/skills/README.md +408 -0
- package/skills/git/commit-crafting/SKILL.md +79 -0
- package/skills/git/commit-crafting/evals.md +92 -0
- package/skills/git/create-pr/SKILL.md +116 -0
- package/skills/git/create-pr/evals.md +114 -0
- package/skills/git/investigate-issue/SKILL.md +139 -0
- package/skills/git/investigate-issue/evals.md +94 -0
- package/skills/git/resolve-merge-conflicts/SKILL.md +96 -0
- package/skills/git/resolve-merge-conflicts/evals.md +58 -0
- package/skills/git/review-changes/SKILL.md +103 -0
- package/skills/git/review-changes/evals.md +85 -0
- package/skills/git/worktree-create/SKILL.md +92 -0
- package/skills/git/worktree-create/evals.md +97 -0
- package/skills/git/worktree-create/references/worktree-setup.md +66 -0
- package/skills/git/worktree-merge/SKILL.md +95 -0
- package/skills/git/worktree-merge/evals.md +114 -0
- package/skills/skill-marketplace.json +261 -0
- package/skills/workflow/cut-it/SKILL.md +86 -0
- package/skills/workflow/cut-it/evals.md +42 -0
- package/src/domains/agents/builtins/architect.md +33 -0
- package/src/domains/agents/builtins/coder.md +31 -0
- package/src/domains/agents/builtins/context-bootstrap.md +38 -0
- package/src/domains/agents/builtins/debugger.md +30 -0
- package/src/domains/agents/builtins/documenter.md +31 -0
- package/src/domains/agents/builtins/git-master.md +30 -0
- package/src/domains/agents/builtins/provenance.md +30 -0
- package/src/domains/agents/builtins/researcher.md +71 -0
- package/src/domains/agents/builtins/scout.md +42 -0
- package/src/domains/agents/builtins/tester.md +31 -0
- package/src/domains/agents/builtins/verifier.md +30 -0
- package/src/domains/agents/builtins/wiki-writer.md +41 -0
- package/src/domains/agents/fleets/build-review.md +34 -0
- package/src/domains/agents/fleets/build-test.md +35 -0
- package/src/domains/agents/fleets/sdlc.md +86 -0
- package/src/domains/prompts/fragments/identity/clio-worker.md +11 -0
- package/src/domains/prompts/fragments/identity/clio.md +26 -0
- package/src/domains/prompts/fragments/operating/contract.md +64 -0
- package/src/domains/prompts/fragments/safety/auto-edit.md +14 -0
- package/src/domains/prompts/fragments/safety/full-auto.md +14 -0
- package/src/domains/prompts/fragments/safety/read-only.md +13 -0
- package/src/domains/prompts/fragments/safety/suggest.md +13 -0
- package/src/domains/prompts/fragments/wiki/page.md +75 -0
- package/src/domains/prompts/fragments/wiki/plan.md +48 -0
- package/src/domains/providers/models/cloud-models/alcf.yaml +40 -0
- package/src/domains/providers/models/local-models/clio-local-coding-targets.yaml +993 -0
package/docs/README.md
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="../assets/clio-coder-logo-128.webp" alt="Clio Coder logo" width="96" height="96" />
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
# Clio Coder Documentation
|
|
6
|
+
|
|
7
|
+
These pages document `v0.3.0` of Clio Coder, an open-source coding orchestrator within the [IOWarp](https://iowarp.ai) scientific computing platform, created by the [Gnosis Research Center](https://grc.iit.edu) at the [Illinois Institute of Technology](https://www.iit.edu).
|
|
8
|
+
|
|
9
|
+
They are source-aligned guides: when prose and source disagree, prefer the
|
|
10
|
+
current source, tests, and `CHANGELOG.md`.
|
|
11
|
+
|
|
12
|
+
## Start Here
|
|
13
|
+
|
|
14
|
+
| Need | Guide |
|
|
15
|
+
| --- | --- |
|
|
16
|
+
| Commands, slash commands, operating posture, keybindings, dispatch, verification, and troubleshooting | [commands-and-modes.md](commands-and-modes.md) ([Interactive Blueprint](html/commands_blueprint.html)) |
|
|
17
|
+
| Context window resolution, per-model probe capabilities, token accounting, per-turn snapshots, compaction, and context priming | [context-engine.md](context-engine.md) ([Interactive Blueprint](html/context_blueprint.html)) |
|
|
18
|
+
| Runtime targets, local model configuration, fleet profiles, and auth | [configuration-and-targets.md](configuration-and-targets.md) ([Interactive Blueprint](html/configuration_blueprint.html)) |
|
|
19
|
+
| Every environment variable the runtime reads: guardrail overrides, directory layout, debug toggles, and internal plumbing | [environment-variables.md](environment-variables.md) ([Interactive Blueprint](html/environment_blueprint.html)) |
|
|
20
|
+
| Argonne ALCF Sophia/Metis inference targets over Globus OAuth | [alcf-provider.md](alcf-provider.md) ([Interactive Blueprint](html/alcf_blueprint.html)) |
|
|
21
|
+
| Installation, upgrade, reset, uninstallation, configuration folders, and permissions | [installation-and-lifecycle.md](installation-and-lifecycle.md) ([Interactive Blueprint](html/lifecycle_blueprint.html)) |
|
|
22
|
+
| Safety posture, default-deny Bash, project policy, damage-control rules, and typed validation | [safety-model.md](safety-model.md) ([Interactive Blueprint](html/safety_blueprint.html)) |
|
|
23
|
+
| Source layout, compile-time boundaries, domain loading, and runtime data flow | [architecture.md](architecture.md) ([Interactive Blueprint](html/architecture_blueprint.html)) |
|
|
24
|
+
| Why the dispatch domain is not split, which invariants cross the obvious seams, and why direct subpath imports are permitted | [dispatch-architecture-rationale.md](dispatch-architecture-rationale.md) |
|
|
25
|
+
| Prompt envelope reuse, provider tool delivery, and bounded tool results | [prompt-envelope-and-tools.md](prompt-envelope-and-tools.md) ([Interactive Blueprint](html/tools_blueprint.html)) |
|
|
26
|
+
| In-depth reference for all 19 worker tools: parameters, typical payloads, and error examples | [tool-usage.md](tool-usage.md) ([Interactive Blueprint](html/tool_usage_blueprint.html)) |
|
|
27
|
+
| Developer guide to implementing custom model runtimes and inference server integrations | [provider-adapter-cookbook.md](provider-adapter-cookbook.md) ([Interactive Blueprint](html/provider_adapter_blueprint.html)) |
|
|
28
|
+
| Built-in agent recipes, discovery roots, frontmatter schema, and dispatch admission | [built-in-agents.md](built-in-agents.md) ([Interactive Blueprint](html/agents_blueprint.html)) |
|
|
29
|
+
| Artifact browsing, receipt verification, dispatch diagnostics, and observability routing | [observability.md](observability.md) ([Interactive Blueprint](html/observability_blueprint.html)) |
|
|
30
|
+
| Evidence directory structures, findings, and operator-approved memory retrieval | [evidence-and-memory.md](evidence-and-memory.md) ([Interactive Blueprint](html/memory_blueprint.html)) |
|
|
31
|
+
| Local YAML eval suites, reports, comparisons, and command evidence | [eval-runner.md](eval-runner.md) ([Interactive Blueprint](html/eval_blueprint.html)) |
|
|
32
|
+
| Prompt and skill resources, extension manifests, and portable share archives | [extensions-and-sharing.md](extensions-and-sharing.md) ([Interactive Blueprint](html/extensions_blueprint.html)) |
|
|
33
|
+
| Skills Hub marketplace discovery, install actions, and publishing flow | [skills-marketplace.md](skills-marketplace.md) ([Interactive Blueprint](html/skills_blueprint.html)) |
|
|
34
|
+
| Runtime model refresh, catalog sources, local/cloud model quirks, and benchmarking notes | [model-catalog.md](model-catalog.md) ([Interactive Blueprint](html/models_blueprint.html)) |
|
|
35
|
+
| Active component snapshots and the experimental middleware hook/effect contract | [middleware-and-components.md](middleware-and-components.md) ([Interactive Blueprint](html/middleware_blueprint.html)) |
|
|
36
|
+
| Advisory validation-contract patterns for scientific artifacts and HPC assumptions | [scientific-validation.md](scientific-validation.md) ([Interactive Blueprint](html/validation_blueprint.html)) |
|
|
37
|
+
| Falsifiable Change Manifest JSON templates, auditability, and `clio-coder evolve` | [evolution.md](evolution.md) ([Interactive Blueprint](html/evolution_blueprint.html)) |
|
|
38
|
+
| Source-first docs workflow, mapping matrix, and alpha wording guidance | [documentation-guide.md](documentation-guide.md) ([Interactive Blueprint](html/documentation_blueprint.html)) |
|
|
39
|
+
| Interface layout, colors palette, Unicode character vocabulary, and drawing choreography | [tui-design.md](tui-design.md) ([Interactive Blueprint](html/tui_design_blueprint.html)) |
|
|
40
|
+
| NDJSON parent-child socket protocols, watchdog timers, and exit status mapping | [worker-dispatch-mechanics.md](worker-dispatch-mechanics.md) ([Interactive Blueprint](html/worker_dispatch_blueprint.html)) |
|
|
41
|
+
| Multi-node fleet dispatch: process-safe admission, attested workers, measured routing, activation, agent automation, topologies, and receipts | [fleet-dispatch.md](fleet-dispatch.md) ([Interactive Blueprint](html/fleet_dispatch_blueprint.html)) |
|
|
42
|
+
| Multi-process capacity leases, heartbeat TTLs, cross-process locks, and cluster drain controls | [capacity-and-scheduling.md](capacity-and-scheduling.md) |
|
|
43
|
+
| Executable multi-node demo with reviewer gate and receipt provenance walkthrough | [fleet-demo-runbook.md](fleet-demo-runbook.md) |
|
|
44
|
+
| Session lifecycle, on-disk ledger format v3, `/tree` active-path lineage, `/fork`, `/resume`, checkpoints, and recovery | [session-lifecycle.md](session-lifecycle.md) |
|
|
45
|
+
| Agent Client Protocol (ACP) server over stdio, tool mediation, non-stall permissions, and error taxonomy | [acp.md](acp.md) |
|
|
46
|
+
| Version registry and migration policies for all 9 serialized artifact schemas | [artifact-versions.md](artifact-versions.md) |
|
|
47
|
+
| Process exit code taxonomy, `--help` standard, machine-readable JSON streaming, and headless output contracts | [exit-codes-and-output.md](exit-codes-and-output.md) |
|
|
48
|
+
| Actionable error remediation and diagnostics keyed by exact user-facing messages | [troubleshooting.md](troubleshooting.md) |
|
|
49
|
+
| Canonical definitions of 17 core architectural concepts mapped to `src/` types | [glossary.md](glossary.md) |
|
|
50
|
+
| Complete source-to-documentation mapping matrix and subsystem coverage status | [documentation-coverage.md](documentation-coverage.md) |
|
|
51
|
+
| Proactive task memory architecture, session task bank, intervention rules, and handoff carrying | [proactive-memory.md](proactive-memory.md) ([Interactive Blueprint](html/memory_blueprint.html)) |
|
|
52
|
+
| WAL SQLite trace mirror database schema, rowid cursor queries, rebuildability, and CLI trace subcommands | [trace-store.md](trace-store.md) ([Interactive Blueprint](html/trace_blueprint.html)) |
|
|
53
|
+
| Private context index determinism, target smoke matrices, and Clio machinery soak benchmark suite | [evals-internal.md](evals-internal.md) ([Blueprints: evals_internal](html/evals_internal_blueprint.html), [soak](html/soak_blueprint.html)) |
|
|
54
|
+
| Point-in-time inventory of legacy environment variables (Historical Appendix) | [config-knobs-audit.md](config-knobs-audit.md) ([Interactive Blueprint](html/config_knobs_audit_blueprint.html)) |
|
|
55
|
+
|
|
56
|
+
Every project Clio works in gets its context from a checked-in `CLIO-CODER.md`,
|
|
57
|
+
bootstrapped and maintained by `clio-coder context init`. The root
|
|
58
|
+
[CLIO-CODER.md](../CLIO-CODER.md) of this repository is the maintained reference example
|
|
59
|
+
of the format.
|
|
60
|
+
|
|
61
|
+
## Developer Quick Start
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
git clone https://github.com/iowarp/clio-coder.git
|
|
65
|
+
cd clio-coder
|
|
66
|
+
npm run install:local
|
|
67
|
+
hash -r
|
|
68
|
+
clio-coder --version
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
The local symlink executes `dist/cli/index.js`. If you edit TypeScript files
|
|
72
|
+
under `src/`, run `npm run build` again or keep `npm run dev` running.
|
|
73
|
+
|
|
74
|
+
## Release Notes
|
|
75
|
+
|
|
76
|
+
The release entry point is [../README.md](../README.md); detailed release
|
|
77
|
+
history lives in [../CHANGELOG.md](../CHANGELOG.md). For v0.3.0 the supported
|
|
78
|
+
install path is a source checkout through `npm run install:local`, the
|
|
79
|
+
deterministic release gate is `npm run ci:release`, live model smoke
|
|
80
|
+
validation is local/manual and opt-in through `npm run test:live` (add
|
|
81
|
+
`-- --delegation` for opencode/copilot checks), and the package
|
|
82
|
+
is not published to npm.
|
|
83
|
+
|
|
84
|
+
## Writing Documentation
|
|
85
|
+
|
|
86
|
+
Guidance for doc authors lives in
|
|
87
|
+
[documentation-guide.md](documentation-guide.md). The short version:
|
|
88
|
+
|
|
89
|
+
- State alpha status plainly; do not imply npm publication, production
|
|
90
|
+
stability, or universal local-model behavior without current proof.
|
|
91
|
+
- Prefer command examples that are valid against
|
|
92
|
+
`node dist/cli/index.js --help`.
|
|
93
|
+
- Keep the README short; detailed command explanations belong in these pages.
|
package/docs/acp.md
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
# Agent Client Protocol (ACP) Server
|
|
2
|
+
|
|
3
|
+
This document defines the architecture, transport protocols, tool mediation layers, permission handling, and error taxonomy for Clio Coder's Agent Client Protocol (ACP) server implementation in `v0.3.0`.
|
|
4
|
+
|
|
5
|
+
Source implementations: `src/engine/acp/` and `src/cli/acp.ts`.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## 1. Overview & Protocol Specification
|
|
10
|
+
|
|
11
|
+
Clio Coder provides a native ACP server via the `clio-coder acp` command. The server implements the open Agent Client Protocol specification (ACP v1 / schema 0.4.5) over standard I/O JSON-RPC 2.0 transport (`src/engine/acp/transport.ts`).
|
|
12
|
+
|
|
13
|
+
The ACP server allows external IDEs, editors (such as Zed), and automated orchestration engines to drive Clio Coder sessions over a structured protocol.
|
|
14
|
+
|
|
15
|
+
```mermaid
|
|
16
|
+
graph LR
|
|
17
|
+
client[External ACP Client] <-->|JSON-RPC 2.0 / stdio| server[Clio ACP Server]
|
|
18
|
+
server --> mediator[Tool Mediator & Safety Net]
|
|
19
|
+
mediator --> engine[Clio Execution Engine]
|
|
20
|
+
mediator --> session[Session Ledger v3]
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## 2. Server Command & Transport Wiring
|
|
26
|
+
|
|
27
|
+
The server is invoked via:
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
clio-coder acp [--cwd PATH] [--permission-timeout MS]
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
- `--cwd PATH`: Sets the initial workspace root directory for ACP sessions.
|
|
34
|
+
- `--permission-timeout MS`: Configures the maximum timeout for delegated permission resolution (defaults to `DEFAULT_DELEGATION_PERMISSION_TIMEOUT_MS = 120000` ms from `src/core/defaults.ts:40`).
|
|
35
|
+
|
|
36
|
+
Transport frames are JSON-RPC 2.0 messages serialized over `stdin`/`stdout`. All logging and diagnostic output is strictly routed to `stderr` to preserve standard I/O framing integrity.
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## 3. Supported ACP Methods
|
|
41
|
+
|
|
42
|
+
The ACP server implements the core ACP RPC methods (`src/engine/acp/server.ts`):
|
|
43
|
+
|
|
44
|
+
| Method | Direction | Description |
|
|
45
|
+
| :--- | :--- | :--- |
|
|
46
|
+
| `initialize` | Client → Server | Negotiates protocol version, agent capabilities, and server implementation info. |
|
|
47
|
+
| `session/new` | Client → Server | Initializes a new Clio session, snapshotting the active autonomy posture and working directory. |
|
|
48
|
+
| `session/load` | Client → Server | Resumes an existing session by ID and synchronizes message history. |
|
|
49
|
+
| `session/list` | Client → Server | Lists known sessions for the current workspace root. |
|
|
50
|
+
| `session/delete` | Client → Server | Deletes a session and its persistent files. |
|
|
51
|
+
| `session/prompt` | Client → Server | Submits a user prompt to the session execution loop. |
|
|
52
|
+
| `session/cancel` | Client → Server | Cancels an in-flight prompt stream or running tool operation. |
|
|
53
|
+
| `session/request_permission` | Server → Client | Requests permission from the client for gated tool operations. |
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
## 4. Tool Mediation & Safety Governance
|
|
58
|
+
|
|
59
|
+
Tool execution entering through the ACP server is mediated by `src/engine/acp/tool-mediator.ts:createAcpToolMediator`.
|
|
60
|
+
|
|
61
|
+
### Canonical Tool Mapping
|
|
62
|
+
|
|
63
|
+
Clio tool names are mapped to the closed ACP `ToolKind` enumeration (`src/engine/acp/types.ts`):
|
|
64
|
+
|
|
65
|
+
| Clio Tool Name | ACP `ToolKind` | Primary Action Category |
|
|
66
|
+
| :--- | :--- | :--- |
|
|
67
|
+
| `read`, `ls`, `context` | `read` | Workspace inspection |
|
|
68
|
+
| `write`, `edit`, `artifact` | `edit` | Workspace mutation |
|
|
69
|
+
| `grep`, `find`, `code_nav` | `search` | Codebase exploration |
|
|
70
|
+
| `bash`, `verify`, `git` | `execute` | Shell & command execution |
|
|
71
|
+
| `web_fetch` | `fetch` | Network retrieval |
|
|
72
|
+
| Dynamic / MCP tools | `other` | Unmapped fallback |
|
|
73
|
+
|
|
74
|
+
### Non-Stall Permission Mediation
|
|
75
|
+
|
|
76
|
+
Under `clio-policy` governance:
|
|
77
|
+
1. Tool calls evaluate through the 10-step safety net policy engine.
|
|
78
|
+
2. If the safety net or autonomy level yields an `ask` verdict (such as mutating actions at `suggest` level or unrecognized bash at `auto-edit` level), the mediator resolves the ask as a **non-stall denial** (`autonomyDenyRejection`).
|
|
79
|
+
3. This non-stall behavior prevents external non-interactive client connections from hanging indefinitely while preserving safety boundaries.
|
|
80
|
+
|
|
81
|
+
---
|
|
82
|
+
|
|
83
|
+
## 5. Security & Boundary Guarantees
|
|
84
|
+
|
|
85
|
+
The ACP boundary enforces strict isolation rules:
|
|
86
|
+
|
|
87
|
+
1. **Autonomy Snapshotting**: The autonomy level is snapshotted at `session/new`. A subsequent configuration change on the host does not alter an active remote session's security policy.
|
|
88
|
+
2. **Metadata Namespacing**: Clio-specific extensions travel exclusively within namespaced metadata fields (`ACP_USAGE_META_KEY = "clio.coder/usage"`, `ACP_SESSION_META_KEY = "clio.coder/session"` in `src/engine/acp/types.ts:8-9`). Strict clients (e.g. Zed Serde deserializers) never encounter unmapped top-level keys.
|
|
89
|
+
3. **No External Outcome Overrides**: External ACP processes cannot self-assert terminal outcome codes (e.g. `worker_final_output_missing` is enforced at Clio's trusted finalization seam).
|
|
90
|
+
|
|
91
|
+
---
|
|
92
|
+
|
|
93
|
+
## 6. Error Taxonomy
|
|
94
|
+
|
|
95
|
+
The ACP subsystem defines four typed error classes (`src/engine/acp/errors.ts`):
|
|
96
|
+
|
|
97
|
+
```typescript
|
|
98
|
+
export class AcpError extends Error {
|
|
99
|
+
readonly code: string;
|
|
100
|
+
readonly data?: unknown;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export class AcpProtocolError extends AcpError {
|
|
104
|
+
constructor(message: string, data?: unknown) {
|
|
105
|
+
super("acp_protocol_error", message, data);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export class AcpTimeoutError extends AcpError {
|
|
110
|
+
constructor(message: string, data?: unknown) {
|
|
111
|
+
super("acp_timeout", message, data);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export class AcpProcessError extends AcpError {
|
|
116
|
+
constructor(message: string, data?: unknown) {
|
|
117
|
+
super("acp_process_error", message, data);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
```
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# ALCF Inference Provider
|
|
2
|
+
|
|
3
|
+
> [!TIP]
|
|
4
|
+
> **Interactive Spec Available:** An interactive target configurator and Globus OAuth flow diagram is located at [docs/html/alcf_blueprint.html](html/alcf_blueprint.html) (Version: 0.3.0).
|
|
5
|
+
|
|
6
|
+
Clio can use Argonne's ALCF inference gateway as an OpenAI-compatible target
|
|
7
|
+
backed by Globus OAuth. The runtime id is `alcf`; each configured target points
|
|
8
|
+
at one gateway cluster URL, such as Sophia or Metis.
|
|
9
|
+
|
|
10
|
+
The login flow is SSH-friendly. `clio-coder auth login alcf` opens a Globus authorize
|
|
11
|
+
URL and asks you to paste back the displayed authorization code. Clio stores the
|
|
12
|
+
resulting OAuth refresh/access credential in `providers.auth` persisted through `openAuthStorage()`,
|
|
13
|
+
refreshed through the same provider auth path used by other OAuth runtimes.
|
|
14
|
+
|
|
15
|
+
## Configure
|
|
16
|
+
|
|
17
|
+
Authenticate first:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
clio-coder auth login alcf
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Then register one or both cluster targets:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
clio-coder configure \
|
|
27
|
+
--id alcf-sophia \
|
|
28
|
+
--runtime alcf \
|
|
29
|
+
--url https://inference-api.alcf.anl.gov/resource_server/sophia/vllm/v1 \
|
|
30
|
+
--model openai/gpt-oss-120b \
|
|
31
|
+
--max-tokens 4096
|
|
32
|
+
|
|
33
|
+
clio-coder configure \
|
|
34
|
+
--id alcf-metis \
|
|
35
|
+
--runtime alcf \
|
|
36
|
+
--url https://inference-api.alcf.anl.gov/resource_server/metis/api/v1 \
|
|
37
|
+
--model gpt-oss-120b \
|
|
38
|
+
--max-tokens 4096
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Sophia currently uses `vllm` in the URL and serves `openai/`-prefixed model ids.
|
|
42
|
+
Metis currently uses `api` in the URL and serves bare model ids. Clio sends the
|
|
43
|
+
configured wire model id literally and does not rewrite it.
|
|
44
|
+
|
|
45
|
+
Set a target as the chat default when you are ready:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
clio-coder targets use alcf-sophia
|
|
49
|
+
clio-coder targets --probe
|
|
50
|
+
clio-coder models --target alcf-sophia
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Implementation Notes
|
|
54
|
+
|
|
55
|
+
The implementation is intentionally inside Clio Coder rather than downstream
|
|
56
|
+
scientific apps:
|
|
57
|
+
|
|
58
|
+
- `src/engine/alcf-oauth.ts` implements the Globus PKCE paste-code OAuth flow.
|
|
59
|
+
- `src/engine/oauth.ts` registers the Clio-owned OAuth provider through the
|
|
60
|
+
engine boundary.
|
|
61
|
+
- `src/domains/providers/runtimes/cloud/alcf.ts` implements Sophia/Metis
|
|
62
|
+
discovery and reuses the generic OpenAI-compatible chat synthesis.
|
|
63
|
+
- `ProbeContext.authToken` carries a resolved stored/API/OAuth bearer into live
|
|
64
|
+
probes so authenticated model discovery does not reach into auth storage.
|
|
65
|
+
- ALCF rejects non-standard `chat_template_kwargs` request fields. The runtime
|
|
66
|
+
marks synthesized models with `clio.chatTemplateKwargsUnsupported`, and the
|
|
67
|
+
OpenAI-compatible engine adapter omits that field while still sending the
|
|
68
|
+
accepted top-level `reasoning_effort`.
|
|
69
|
+
|
|
70
|
+
Live model availability depends on which gateway jobs are running. The static
|
|
71
|
+
model list is only a fallback for offline resolution; `clio-coder targets --probe`
|
|
72
|
+
uses the ALCF catalog and jobs endpoints after authentication.
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
# Clio Coder Architecture and Boundaries
|
|
2
|
+
|
|
3
|
+
> [!TIP]
|
|
4
|
+
> **Interactive Spec Available:** An interactive dashboard is located at [docs/html/architecture_blueprint.html](html/architecture_blueprint.html) (Version: 0.3.0).
|
|
5
|
+
|
|
6
|
+
Clio Coder is an experimental, terminal-first coding harness for the CLIO ecosystem. CLIO stands for Context Layer for Input/Output; the project is named for the Greek muse of history and developed by the Gnosis Research Center at Illinois Tech. Its architecture favors small, auditable subsystems over a single monolithic agent loop: CLI entry points, the interactive TUI, provider/runtime code, worker subprocesses, tools, and feature domains are kept separate so local-model support and scientific-software workflows can evolve without collapsing safety boundaries.
|
|
7
|
+
|
|
8
|
+
This page is source-code aligned for the current `v0.3.0` development line.
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## Source layout
|
|
13
|
+
|
|
14
|
+
```text
|
|
15
|
+
src/
|
|
16
|
+
├── cli/ # clio subcommands, argument parsing, headless run modes
|
|
17
|
+
├── core/ # config/state paths, event bus, defaults, shared primitives
|
|
18
|
+
├── domains/ # feature domains loaded through manifests/contracts
|
|
19
|
+
├── engine/ # pi-ai/provider boundary and runtime adapters
|
|
20
|
+
├── entry/ # orchestrator bootstrap wiring
|
|
21
|
+
├── interactive/ # TUI panels, overlays, key routing, dashboard, slash commands
|
|
22
|
+
├── tools/ # built-in tool specs and registry admission boundary
|
|
23
|
+
├── worker/ # subprocess worker entry/runtime rehydration
|
|
24
|
+
└── utils/ # small support utilities
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Registered domain modules include:
|
|
28
|
+
|
|
29
|
+
| Domain | Primary source | Public surface |
|
|
30
|
+
| --- | --- | --- |
|
|
31
|
+
| agents | `src/domains/agents/**` | Built-in, user, and project agent recipes. |
|
|
32
|
+
| components | `src/domains/components/**` | Component snapshots, diffs, and classification. |
|
|
33
|
+
| config | `src/domains/config/**`, `src/core/config.ts` | `settings.yaml`, keybindings, hot reload. |
|
|
34
|
+
| context | `src/domains/context/**` | `CLIO-CODER.md`, codewiki indexer, repository context. |
|
|
35
|
+
| dispatch | `src/domains/dispatch/**` | Fleet-agent jobs, receipts, worker spawning, route policies. |
|
|
36
|
+
| eval | `src/domains/eval/**` | Local evaluation harness, suites, JUnit/SWE-bench reports. |
|
|
37
|
+
| evidence | `src/domains/evidence/**` | Forensic evidence bundles, failure attribution. |
|
|
38
|
+
| evolution | `src/domains/evolution/**` | Authority-tiered self-edit manifests and gates. |
|
|
39
|
+
| extensions | `src/domains/extensions/**` | Extension discovery, packaging, and lifecycle. |
|
|
40
|
+
| lifecycle | `src/domains/lifecycle/**` | Doctor diagnostics, upgrade mechanics, uninstallation. |
|
|
41
|
+
| memory | `src/domains/memory/**` | Approved long-term memory, proactive task intervention. |
|
|
42
|
+
| middleware | `src/domains/middleware/**` | Declarative and programmatic lifecycle hooks and budgets. |
|
|
43
|
+
| observability | `src/domains/observability/**` | SQLite trace store, metrics projections, live telemetry. |
|
|
44
|
+
| prompts | `src/domains/prompts/**` | Prompt fragments, system prompt envelope, template hashing. |
|
|
45
|
+
| providers | `src/domains/providers/**` | Target-first runtime registry, model probing, credentials. |
|
|
46
|
+
| resources | `src/domains/resources/**` | Skills loader, marketplace synchronization, prompts loader. |
|
|
47
|
+
| safety | `src/domains/safety/**` | 10-step policy engine, path policy, zero-access rails, audit. |
|
|
48
|
+
| scheduling | `src/domains/scheduling/**` | Budget ceilings, node cluster states, batch capacity checks. |
|
|
49
|
+
| session | `src/domains/session/**` | Append-only JSONL transcripts, tree navigation, compaction. |
|
|
50
|
+
| share | `src/domains/share/**` | Portable workspace and resource archive export/import. |
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
## Session Routing vs. Persisted Settings
|
|
55
|
+
|
|
56
|
+
Clio maintains an explicit distinction between persisted user settings (`settings.yaml`) and session-local routing state (`src/core/session-routing.ts`).
|
|
57
|
+
|
|
58
|
+
1. **Decoupled Overlays**: Turn-level selections (such as active target, model override, thinking level, and scoped models cycled via Alt+J / Alt+K) apply dynamically through `applySessionRouting` without mutating `settings.yaml`.
|
|
59
|
+
2. **Lifecycle Flow**:
|
|
60
|
+
- `seedSessionRouting`: Seeds runtime fields from configuration at startup.
|
|
61
|
+
- `applyRoutingPatch`: Applies surgical routing mutations (such as changing active model or target in the TUI).
|
|
62
|
+
- `diffRouting`: Detects when an active session's routing diverges from `settings.yaml`.
|
|
63
|
+
- `routingChangeNotices`: Generates structured notifications when external edits modify `settings.yaml` during an active session, allowing graceful reconciliation.
|
|
64
|
+
- `restoreRoutingFields`: Restores persisted defaults when resetting session overlays.
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
## Workspace Enumeration and Language Classification
|
|
69
|
+
|
|
70
|
+
Source: `src/core/workspace-files.ts`, `src/core/c-header-language.ts`.
|
|
71
|
+
|
|
72
|
+
1. **Filesystem Walker Invariants**:
|
|
73
|
+
Fallback workspace file enumeration enforces strict safety caps to prevent runaway memory usage or hangs on massive trees:
|
|
74
|
+
- `maxVisitedEntries`: 100,000 entries
|
|
75
|
+
- `maxDepth`: 64 directory levels
|
|
76
|
+
- `maxPathBytes`: 64 MiB total path storage
|
|
77
|
+
- `maxDurationMs`: 5,000 ms timeout
|
|
78
|
+
2. **C/C++ Header Classification**:
|
|
79
|
+
Header files (`.h`, `.hpp`, `.hxx`, `.hh`) are classified deterministically through a 3-tier inspection pipeline:
|
|
80
|
+
- Tier 1: Sibling source matches (for example matching `.cpp` or `.c` with the same base name).
|
|
81
|
+
- Tier 2: Distinctive `#include` directives (standard C++ headers vs standard C headers).
|
|
82
|
+
- Tier 3: Language-exclusive tokens (`template<`, `namespace `, `class `, `nullptr`, `constexpr`).
|
|
83
|
+
|
|
84
|
+
## Boundary invariants
|
|
85
|
+
|
|
86
|
+
`npm run check:boundaries` executes the boundary check suite (`tests/boundaries/check-boundaries.ts`). Treat these checks as executable specifications.
|
|
87
|
+
|
|
88
|
+
These five enforced boundary rules constrain dependency **direction**, never import **form** (whether static vs dynamic, default vs named):
|
|
89
|
+
|
|
90
|
+
### Rule 1: `@earendil-works/*` imports stay in `src/engine/**`
|
|
91
|
+
|
|
92
|
+
Only files under `src/engine/**` may import `@earendil-works/*` packages. Since the 0.83.0 engine-boundary rework, no file outside `src/engine/**` may import `@earendil-works/*` at all, value or type-only. Domain modules import erased engine shapes (`EngineModel`, `Api`, `Model`) directly from `src/engine/types.ts`.
|
|
93
|
+
|
|
94
|
+
Why: provider SDKs and pi-ai engine values must remain swappable behind one engine boundary. Domains and presentation layers operate against Clio contracts rather than vendor or runtime implementations.
|
|
95
|
+
|
|
96
|
+
### Rule 2: Workers do not value-import domains except runtime rehydration
|
|
97
|
+
|
|
98
|
+
Files under `src/worker/**` may not value-import `src/domains/**`, with the sole exception of worker-safe provider runtime rehydration modules:
|
|
99
|
+
|
|
100
|
+
- `src/domains/providers/plugins.ts`
|
|
101
|
+
- `src/domains/providers/registry.ts`
|
|
102
|
+
- `src/domains/providers/runtimes/builtins.ts`
|
|
103
|
+
|
|
104
|
+
Type-only imports erase at compile time and are permitted. Workers receive a serializable `WorkerSpec` envelope, rehydrate only necessary target/runtime descriptors, and avoid pulling interactive state or domain stores into worker subprocesses.
|
|
105
|
+
|
|
106
|
+
### Rule 3: Domains do not import each other's `extension.ts`
|
|
107
|
+
|
|
108
|
+
A file under `src/domains/<x>/**` must not import `src/domains/<y>/extension.ts` for `y != x`. Cross-domain behavior flows through public contracts exported from domain index files (`src/domains/<y>/index.ts`), the domain loader, event buses, or serialized manifests.
|
|
109
|
+
|
|
110
|
+
### Rule 4: Tool substrate is surface-agnostic (`src/tools/**` never imports `src/interactive/**`)
|
|
111
|
+
|
|
112
|
+
Files under `src/tools/**` may never import `src/interactive/**` (neither value nor type-only imports). The tool substrate is surface-agnostic across headless, interactive, ACP, and worker runs. Allowing tools to import TUI presentation modules would couple execution logic to presentation code.
|
|
113
|
+
|
|
114
|
+
### Rule 5: One-way entry point composition (`chat-loop.ts` never imports `src/entry/**`)
|
|
115
|
+
|
|
116
|
+
Turn modules and state machine files in the chat loop (`src/interactive/turn-*.ts`, `chat-loop.ts`) may never import `src/entry/**`. Composition flows in one direction only: the entry point composes the chat loop, never the reverse.
|
|
117
|
+
|
|
118
|
+
---
|
|
119
|
+
|
|
120
|
+
## Runtime flow
|
|
121
|
+
|
|
122
|
+
```mermaid
|
|
123
|
+
graph TD
|
|
124
|
+
CLI[cli/index.ts] --> ORCH[entry/orchestrator.ts]
|
|
125
|
+
TUI[interactive/index.ts] --> LOOP[interactive/chat-loop.ts]
|
|
126
|
+
ORCH --> DOMAINS[domain-loader + domain contracts]
|
|
127
|
+
LOOP --> PROMPTS[prompts compiler]
|
|
128
|
+
LOOP --> TOOLS[tool registry]
|
|
129
|
+
LOOP --> ENGINE[engine runtime]
|
|
130
|
+
TOOLS --> SAFETY[safety policy]
|
|
131
|
+
TOOLS --> MIDDLEWARE[middleware hook boundary]
|
|
132
|
+
ENGINE --> PROVIDERS[provider runtime descriptors]
|
|
133
|
+
DISPATCH[dispatch domain] --> WORKER[worker subprocess]
|
|
134
|
+
WORKER --> PROVIDERS
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
Core data paths:
|
|
138
|
+
|
|
139
|
+
1. CLI or TUI boot initializes config, data, state, and cache directories through `src/core/init.ts`.
|
|
140
|
+
2. The domain loader starts domains according to each `manifest.ts` dependency list.
|
|
141
|
+
3. The chat loop resolves model/runtime state and visible tools for the selected target and request intent.
|
|
142
|
+
4. The prompt compiler builds a hashed prompt envelope and dynamic turn fragments.
|
|
143
|
+
5. Tool calls enter `src/tools/registry.ts`, which enforces visibility, safety, middleware hooks, protected artifacts, and result shaping before returning output.
|
|
144
|
+
6. Fleet dispatch writes run ledger entries and receipts; evidence/memory/eval domains consume those artifacts later.
|
|
145
|
+
|
|
146
|
+
---
|
|
147
|
+
|
|
148
|
+
## Event and audit model
|
|
149
|
+
|
|
150
|
+
Clio uses in-process event buses for status and audit surfaces, but safety is not delegated to events. The hard gate lives in code:
|
|
151
|
+
|
|
152
|
+
- Provider capability resolution decides whether tool schemas are sent at all; tool-capable sessions receive the full registry as one deterministic session tool surface.
|
|
153
|
+
- `src/domains/safety/policy-engine.ts` evaluates damage-control rules, project policy, Bash default-deny, and path policy. Write boundaries are detect-and-rollback mechanisms (such as change tracking and rollbacks), never OS-level sandboxing.
|
|
154
|
+
- `src/tools/registry.ts` is the admission point for every tool invocation.
|
|
155
|
+
- `src/domains/dispatch/receipt-integrity.ts` and related dispatch files persist receipts used by evidence and cost surfaces.
|
|
156
|
+
|
|
157
|
+
## Command spec
|
|
158
|
+
|
|
159
|
+
Interactive slash commands in Clio Coder are governed by a unified declarative command specification registry. This declarative system replaces hand-rolled parsing logic with structured specifications that define the names, aliases, flags, positionals, and subcommands for each entry. The central registry acts as the single source of truth for command matching, argument parsing, autocomplete suggestion generation, and usage help output. The parser processes user input strings using these declarative specifications to generate structured argument objects and canonical command representations. By deriving all command-related behavior from these specifications, the system ensures consistency across usage help messages and autocomplete overlays.
|
|
160
|
+
|
|
161
|
+
---
|
|
162
|
+
|
|
163
|
+
## Verification commands
|
|
164
|
+
|
|
165
|
+
```bash
|
|
166
|
+
npm run check:boundaries
|
|
167
|
+
npm run typecheck
|
|
168
|
+
npm run test
|
|
169
|
+
npm run build
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
Run the focused boundary check before editing `src/engine/**`, `src/worker/**`, or cross-domain imports. Run the full test/build gate before release-facing documentation or behavior changes.
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# Artifact Versions & Serialization Contracts
|
|
2
|
+
|
|
3
|
+
This document is the canonical registry of all versioned file formats, serialized data structures, integrity digests, and migration rules across Clio Coder in `v0.3.0`.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 1. Versioned Artifacts Registry
|
|
8
|
+
|
|
9
|
+
Clio Coder strictly versions every persistent or network-transported data structure. When a reader encounters an incompatible version, it either executes an automated migration or fails closed with a typed error.
|
|
10
|
+
|
|
11
|
+
| Artifact / Subsystem | Current Version | Symbol / Type & Source Location | Persisted Path / Wire Location | Schema Semantics & Version Differences | Mismatch Handling |
|
|
12
|
+
| :--- | :--- | :--- | :--- | :--- | :--- |
|
|
13
|
+
| **Run Receipt** | `15` | `RUN_RECEIPT_INTEGRITY_VERSION = 15`<br>`src/domains/dispatch/receipt-integrity.ts:13` | `<stateDir>/receipts/<runId>.json` | Cryptographically sealed run record. Version 15 covers all base provenance fields, routing intent, quality labels, `validationGrounding`, and `capabilityMismatch`. | Fail-closed. Incompatible receipts fail verification and are never read as evidence. |
|
|
14
|
+
| **Session Ledger** | `3` | `CURRENT_SESSION_FORMAT_VERSION = 3`<br>`src/engine/session.ts:66` | `<stateDir>/sessions/<cwdHash>/<sessionId>/` (`meta.json`, `current.jsonl`, `tree.json`) | Append-only ledger format with UUIDv7 turn IDs, session header line, and tree graph linkage. | Automated migration via `src/domains/session/migrations/` on `/resume`. Earlier unmigratable versions rejected. |
|
|
15
|
+
| **Worker Spec** | `3` | `WORKER_SPEC_VERSION = 3`<br>`src/worker/spec-contract.ts:22` | Subprocess `stdin` control plane JSON payload | Worker invocation parameters, tool surface profile, and execution bounds. | Fail-closed preflight rejection before worker activation. |
|
|
16
|
+
| **Worker Runtime Descriptor** | `2` | `WORKER_RUNTIME_DESCRIPTOR_VERSION = 2`<br>`src/worker/spec-contract.ts:23` | Worker attestation descriptor payload | Attestation descriptor for worker runtime environment and hardware facts. | Attestation mismatch causes immediate process termination. |
|
|
17
|
+
| **Worker Protected Artifact State** | `1` | `WORKER_PROTECTED_ARTIFACT_STATE_VERSION = 1`<br>`src/worker/spec-contract.ts:24` | Worker spec initialization snapshot | Snapshot of active protected artifact paths and validation commands passed to worker. | Worker fails closed before executing mutations. |
|
|
18
|
+
| **Fleet Contract** | `1 \| 2 \| 3 \| 4` (Current: `4`) | `FleetContractVersion = 1 \| 2 \| 3 \| 4`<br>`FLEET_WRITE_BOUNDARY_VERSION = 4`<br>`src/domains/agents/fleet-contract.ts:37, 140` | `.clio-coder/fleets/<name>.yaml`, `.clio-coder/fleets/<name>.yml`, or built-in recipes | Multi-agent workflow contract. v1 is agent-only; v2 adds deterministic code steps; v3 adds bounded loops (`FLEET_LOOP_MAX_ATTEMPTS = 5`) and commit steps; v4 adds declared per-step write boundaries (`writes`). | Reader refuses contracts whose version features it does not support. |
|
|
19
|
+
| **Execution Plan** | `4` | `version: 4` in `interface ExecutionPlan`<br>`src/domains/dispatch/execution-plan.ts:98` | Statically compiled DAG representation in dispatch memory and receipts | Statically unrolled, deterministically hashed execution plan. v4 adds bounded loop nodes, verification staleness tracking, and commit nodes. | Preflight validation rejects unsupported plan versions. |
|
|
20
|
+
| **Eval Artifact** | `4` | `version: 4` in `interface EvalArtifactV4`<br>`src/domains/eval/schema/artifact.ts:51-52` | `<stateDir>/evals/<evalId>.json` | Stored eval results with suite provenance, matrix parameters, and itemized metric outcomes. Note: `EVAL_ARTIFACT_VERSION = 1` in `src/domains/eval/types.ts:2` is legacy/dead code. | Incompatible eval artifacts are rejected during `clio-coder eval report` and `compare`. |
|
|
21
|
+
| **Trace Database** | `1` | `TRACE_SCHEMA_VERSION = 1`<br>`src/domains/observability/trace-store.ts:23` | `<stateDir>/trace.sqlite` (`meta` table `schema_version`) | Schema version for the 7 SQLite trace mirror tables (`runs`, `phases`, `events`, `envelopes`, `gate_results`, `agent_sessions`, `processes`). | Log warning (`[clio:trace]`), trace writing degrades without failing the parent run. |
|
|
22
|
+
| **Capacity State File** | `2` | `version: 2` in `interface CapacityStateFile`<br>`src/domains/dispatch/capacity-lease.ts:40` | `<stateDir>/dispatch-admission.json` | Active capacity leases, drain status, and cross-process lock state. | Corrupted or unparseable state file causes admission to fail closed. |
|
|
23
|
+
| **Protected Artifact Journal** | `1` | `version: 1` in `interface PendingProtectedArtifactRecord`<br>`src/domains/session/protected-artifact-journal.ts:22` | `<stateDir>/protected-artifact-pending/<key>/<id>.json` | Write-ahead durability records for pending protected artifacts. | Leftover records reconciled during session initialization. |
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## 2. Integrity Verification Contracts
|
|
28
|
+
|
|
29
|
+
### Receipt Integrity (Version 15)
|
|
30
|
+
|
|
31
|
+
Receipt integrity authenticates that a sealed receipt matches its ledger envelope without modification. Verification reproduces the canonical JSON serialization and computes the SHA-256 digest:
|
|
32
|
+
|
|
33
|
+
```typescript
|
|
34
|
+
export function computeReceiptDigest(receipt: RunReceiptV15): string {
|
|
35
|
+
const canonical = serializeCanonicalReceipt(receipt);
|
|
36
|
+
return createHash("sha256").update(canonical, "utf8").digest("hex");
|
|
37
|
+
}
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Receipt verification checks:
|
|
41
|
+
1. `integrity.version === 15`.
|
|
42
|
+
2. Calculated SHA-256 matches `integrity.digest`.
|
|
43
|
+
3. All optional fields present in the schema (`validationGrounding`, `capabilityMismatch`, `steering`, `gate`, `plan`, `briefing`) conform to the strict v15 specification.
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## 3. Migration Mechanics
|
|
48
|
+
|
|
49
|
+
Session migrations execute automatically when resuming a session whose `meta.json` format version is less than `CURRENT_SESSION_FORMAT_VERSION = 3`:
|
|
50
|
+
|
|
51
|
+
1. **Discovery**: `src/domains/session/migrations/index.ts:runMigrations` reads the recorded `sessionFormatVersion`.
|
|
52
|
+
2. **Step Execution**: Sequentially runs migration passes (e.g. `v1 -> v2`, `v2 -> v3`), transforming `current.jsonl` entries and reconstructing `tree.json` linkages.
|
|
53
|
+
3. **Atomic Commit**: Staged migrations are written to temporary files, fsync'd, and atomically renamed over the original session files.
|
|
54
|
+
4. **Metadata Update**: `meta.sessionFormatVersion` is updated to `3` and committed to `meta.json`.
|