kodelyth-ecc 1.5.10 → 1.7.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/.github/workflows/publish.yml +19 -0
- package/AGENTS.md +1 -1
- package/CHANGELOG.md +447 -0
- package/CLAUDE.md +48 -16
- package/README.md +265 -81
- package/VERSION +1 -1
- package/actions/ecc-review/README.md +243 -0
- package/actions/ecc-review/action.yml +158 -0
- package/actions/ecc-review/post-comment.js +171 -0
- package/actions/ecc-review/run-review.js +285 -0
- package/agents/backdoor-hunter.md +260 -0
- package/agents/chaos-engineer.md +251 -0
- package/agents/code-stealer-detector.md +228 -0
- package/agents/jailbreak-tester.md +222 -0
- package/agents/license-violation-finder.md +212 -0
- package/agents/prompt-injection-hunter.md +126 -0
- package/agents/secret-hunter.md +209 -0
- package/agents/supply-chain-auditor.md +195 -0
- package/bin/kodelyth-ecc.js +875 -1
- package/bundles/enterprise.md +172 -0
- package/bundles/indie-hacker.md +106 -0
- package/bundles/red-team.md +138 -0
- package/cat +0 -0
- package/commands/dashboard.md +67 -0
- package/commands/devil-mode.md +121 -0
- package/commands/memory-evolve.md +71 -0
- package/commands/replay.md +61 -0
- package/commands/route-model.md +48 -0
- package/commands/swarm.md +68 -0
- package/commands/verify-supply-chain.md +59 -0
- package/docs/dashboard.md +211 -0
- package/docs/evolve.md +303 -0
- package/docs/mcp-clients.md +167 -0
- package/docs/mcp.md +178 -0
- package/docs/replay.md +244 -0
- package/docs/supply-chain.md +207 -0
- package/docs/swarm.md +243 -0
- package/hooks/hooks.json +52 -0
- package/hooks/memory/auto-recall.js +29 -1
- package/hooks/safety/README.md +124 -0
- package/hooks/safety/lib/patterns.js +179 -0
- package/hooks/safety/prompt-injection-guard.js +179 -0
- package/hooks/safety/token-budget.js +229 -0
- package/install.ps1 +199 -2
- package/install.sh +285 -3
- package/package.json +30 -4
- package/rules/common/agent-intent-routing.md +182 -0
- package/rules/common/cost-aware-model-routing.md +152 -0
- package/scripts/dashboard/data.js +353 -0
- package/scripts/dashboard/server.js +324 -0
- package/scripts/dashboard/static/index.html +645 -0
- package/scripts/evolve/analyze.js +303 -0
- package/scripts/evolve/proposals.js +162 -0
- package/scripts/evolve/stats.js +219 -0
- package/scripts/mcp/catalog.js +244 -0
- package/scripts/mcp/client.js +181 -0
- package/scripts/mcp/prompts.js +133 -0
- package/scripts/mcp/resources.js +94 -0
- package/scripts/mcp/server.js +153 -0
- package/scripts/mcp/tools.js +465 -0
- package/scripts/replay/bundle.js +191 -0
- package/scripts/replay/replay.js +107 -0
- package/scripts/router/classify.js +232 -0
- package/scripts/supply-chain/manifest.js +154 -0
- package/scripts/supply-chain/sbom.js +202 -0
- package/scripts/supply-chain/verify.js +102 -0
- package/scripts/swarm/build-plan.js +193 -0
- package/skills/cost-aware-model-routing/SKILL.md +153 -0
- package/skills/kodelyth-quickstart/SKILL.md +7 -0
- package/skills/observability-dashboard/SKILL.md +119 -0
- package/skills/self-evolving-memory/SKILL.md +175 -0
- package/skills/session-replay/SKILL.md +199 -0
- package/skills/supply-chain-verification/SKILL.md +201 -0
- package/skills/swarm-orchestrator/SKILL.md +177 -0
- package/social/card-install.svg +1 -1
- package/social/facebook-group/POST.md +121 -0
- package/social/facebook-group/fb-1-3am-debug.png +0 -0
- package/social/facebook-group/fb-1-3am-debug.svg +97 -0
- package/social/facebook-group/fb-2-cpu-upgrade.png +0 -0
- package/social/facebook-group/fb-2-cpu-upgrade.svg +132 -0
- package/social/facebook-group/fb-3-before-after.png +0 -0
- package/social/facebook-group/fb-3-before-after.svg +94 -0
- package/social/facebook-v150.svg +5 -5
- package/social/github-social-preview.svg +119 -100
- package/social/readme-hero.svg +11 -11
- package/social/section-agents.svg +57 -0
- package/social/section-author.svg +54 -0
- package/social/section-dashboard.svg +59 -0
- package/social/section-devil.svg +54 -0
- package/social/section-hooks.svg +51 -0
- package/social/section-install.svg +42 -0
- package/social/section-learning.svg +52 -0
- package/social/section-mcp.svg +46 -0
- package/social/section-memory.svg +57 -0
- package/social/section-parallel.svg +72 -0
- package/social/section-routing.svg +51 -0
- package/social/x-card-agents-grid.svg +6 -6
- package/tests/dashboard/data.test.js +235 -0
- package/tests/dashboard/server.test.js +240 -0
- package/tests/evolve/analyze.test.js +169 -0
- package/tests/evolve/proposals.test.js +173 -0
- package/tests/evolve/stats.test.js +159 -0
- package/tests/mcp/catalog.test.js +98 -0
- package/tests/mcp/client.test.js +109 -0
- package/tests/mcp/resources-prompts.test.js +70 -0
- package/tests/mcp/tools.test.js +159 -0
- package/tests/replay/bundle.test.js +181 -0
- package/tests/replay/replay.test.js +131 -0
- package/tests/router/classify.test.js +164 -0
- package/tests/safety/patterns.test.js +94 -0
- package/tests/safety/prompt-injection-guard.test.js +111 -0
- package/tests/safety/token-budget.test.js +119 -0
- package/tests/supply-chain/manifest.test.js +147 -0
- package/tests/supply-chain/sbom.test.js +170 -0
- package/tests/supply-chain/verify.test.js +146 -0
- package/tests/swarm/build-plan.test.js +188 -0
- package/wiki/Agent-Reference.md +58 -7
- package/wiki/FAQ.md +204 -7
- package/wiki/Home.md +104 -28
- package/wiki/Hook-Reference.md +1 -1
- package/wiki/Installation-Guide.md +109 -6
- package/wiki/Platform-Support.md +239 -25
- package/wiki/Skill-Reference.md +101 -6
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: observability-dashboard
|
|
3
|
+
description: Localhost-only observability dashboard for Kodelyth ECC. Visualizes memory captures, BM25 search, evolve signals + proposals, full catalog browser, swarm sessions, and token-budget snapshots. Zero telemetry.
|
|
4
|
+
trigger:
|
|
5
|
+
- dashboard
|
|
6
|
+
- observability
|
|
7
|
+
- kodelyth dashboard
|
|
8
|
+
- show me the memory
|
|
9
|
+
- browse skills
|
|
10
|
+
- inspect proposals
|
|
11
|
+
- what has ECC learned
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
# Skill: observability-dashboard
|
|
15
|
+
|
|
16
|
+
A read-only HTTP server bound to `127.0.0.1` that renders a single-page UI over every local data source ECC produces. No build step, no external runtime dependencies, no telemetry, no network access required.
|
|
17
|
+
|
|
18
|
+
## What you can see
|
|
19
|
+
|
|
20
|
+
| Tab | Powered by | Shows |
|
|
21
|
+
|---|---|---|
|
|
22
|
+
| **Overview** | catalog + memory store + evolve store + .orchestration + token-budget | One-glance counts: agents, skills, commands, rules, bundles, captured memories, surfaces, routing misses, pending proposals, swarm sessions. Plus storage paths and token-budget snapshot. |
|
|
23
|
+
| **Memory** | `scripts/memory/store.js` | Total / projects / language breakdown. Live BM25 search box (proxies `recall()`). Recent capture stream with tags + source. |
|
|
24
|
+
| **Evolve** | `scripts/evolve/{stats,proposals}.js` | Top reused memories, top routing-miss clusters, every proposal with status pill. Tells you the exact CLI command to accept. |
|
|
25
|
+
| **Catalog** | `scripts/mcp/catalog.js` | Browse + filter every shipped agent / skill / command / rule / bundle by name, description, or tag. |
|
|
26
|
+
| **Sessions** | `.orchestration/<session>/` | Swarm session list with worker counts and per-worker drill-down (task.md / handoff.md / status.md excerpts). |
|
|
27
|
+
|
|
28
|
+
## When to invoke
|
|
29
|
+
|
|
30
|
+
Use **explicitly**:
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
use observability-dashboard
|
|
34
|
+
|
|
35
|
+
# Boots on http://127.0.0.1:5747, auto-opens browser
|
|
36
|
+
npx kodelyth-ecc dashboard
|
|
37
|
+
|
|
38
|
+
# Custom port, suppress browser open
|
|
39
|
+
npx kodelyth-ecc dashboard --port 8088 --no-open
|
|
40
|
+
|
|
41
|
+
# Bind to a different localhost-aliased host
|
|
42
|
+
npx kodelyth-ecc dashboard --host localhost
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Implicit triggers (the AI should route here):
|
|
46
|
+
|
|
47
|
+
- "show me the memory"
|
|
48
|
+
- "what has ECC learned?"
|
|
49
|
+
- "browse the skills"
|
|
50
|
+
- "what's pending in evolve?"
|
|
51
|
+
- "is there a UI for this?"
|
|
52
|
+
- "open the dashboard"
|
|
53
|
+
|
|
54
|
+
## CLI surface
|
|
55
|
+
|
|
56
|
+
```
|
|
57
|
+
kodelyth-ecc dashboard [--port N] [--host 127.0.0.1] [--no-open]
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
| Flag | Default | Behavior |
|
|
61
|
+
|---|---|---|
|
|
62
|
+
| `--port N` | `5747` | Port to bind. Picks a free port pattern. |
|
|
63
|
+
| `--host H` | `127.0.0.1` | Bind interface. Refuses non-localhost without escape hatch. |
|
|
64
|
+
| `--no-open` | off | Suppress browser auto-open (useful in remote shells / CI smoke). |
|
|
65
|
+
|
|
66
|
+
### Localhost lock
|
|
67
|
+
|
|
68
|
+
Binding to `0.0.0.0`, a public IP, or a non-localhost name is **refused** unless you explicitly set:
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
KODELYTH_DASHBOARD_ALLOW_REMOTE=1 \
|
|
72
|
+
npx kodelyth-ecc dashboard --host 0.0.0.0
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
This is intentionally noisy. The dashboard exposes everything the BM25 store and evolve log have ever recorded. Don't expose it to networks you don't fully control.
|
|
76
|
+
|
|
77
|
+
## API surface (read-only, GET-only)
|
|
78
|
+
|
|
79
|
+
The frontend is just a consumer of these endpoints. You can curl them directly:
|
|
80
|
+
|
|
81
|
+
| Endpoint | Returns |
|
|
82
|
+
|---|---|
|
|
83
|
+
| `GET /api/health` | liveness probe |
|
|
84
|
+
| `GET /api/overview` | counts + storage paths |
|
|
85
|
+
| `GET /api/memory[?limit=N]` | stats + recent captures |
|
|
86
|
+
| `GET /api/memory/search?q=…[&limit=N]` | BM25 results |
|
|
87
|
+
| `GET /api/evolve[?limit=N]` | reuse + miss + proposals snapshot |
|
|
88
|
+
| `GET /api/catalog?kind=…[&q=…&limit=N]` | agents \| skills \| commands \| rules \| bundles |
|
|
89
|
+
| `GET /api/sessions[?limit=N]` | swarm session list |
|
|
90
|
+
| `GET /api/sessions/:name` | worker details for one session |
|
|
91
|
+
| `GET /api/token-budget` | per-session token usage |
|
|
92
|
+
|
|
93
|
+
**Only `GET` is supported.** Any `POST`/`PUT`/`DELETE` returns `405 method not allowed`. The dashboard is a *strict observer* — it cannot mutate memories, accept proposals, or modify any state. All mutations stay in the CLI (`evolve accept`, `memory remember`, etc.).
|
|
94
|
+
|
|
95
|
+
## Hard rules
|
|
96
|
+
|
|
97
|
+
1. **NEVER expose remotely without explicit opt-in.** Default refuses everything except `127.0.0.1` / `localhost`.
|
|
98
|
+
2. **NEVER write data.** GET-only routes. No mutation endpoints.
|
|
99
|
+
3. **NEVER include external assets.** No CDNs, no fonts loaded over the network. Works offline.
|
|
100
|
+
4. **NEVER swallow data-source failures with crashes.** A broken memory store or evolve dir renders empty cards, not a 500 page.
|
|
101
|
+
5. **NEVER cache.** `Cache-Control: no-store` on every response — data is always fresh.
|
|
102
|
+
6. **NEVER allow path traversal.** Static file resolution sandboxed under `scripts/dashboard/static/`.
|
|
103
|
+
|
|
104
|
+
## Composition with other features
|
|
105
|
+
|
|
106
|
+
| Pair with | Effect |
|
|
107
|
+
|---|---|
|
|
108
|
+
| **`/memory remember`** | New memories appear in the **Memory** tab on next refresh. |
|
|
109
|
+
| **`kodelyth-ecc evolve analyze`** | New proposals appear in the **Evolve** tab as `pending`. |
|
|
110
|
+
| **`kodelyth-ecc evolve accept`** | The status pill flips from `pending` → `accepted` after refresh. |
|
|
111
|
+
| **`kodelyth-ecc swarm`** | New `.orchestration/<session>/` dirs surface in the **Sessions** tab. |
|
|
112
|
+
| **token-budget hook** | Per-session token totals appear on the **Overview** tab. |
|
|
113
|
+
|
|
114
|
+
## See also
|
|
115
|
+
|
|
116
|
+
- `commands/dashboard.md` — `/dashboard` slash command
|
|
117
|
+
- `docs/dashboard.md` — full reference + curl examples + architecture notes
|
|
118
|
+
- `scripts/dashboard/{server,data}.js` — implementation
|
|
119
|
+
- `scripts/dashboard/static/index.html` — single-page UI
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: self-evolving-memory
|
|
3
|
+
description: Phase 3.4 — turn repeated memory hits and routing misses into proposed skill / routing-rule upgrades. Never auto-applies; produces PR-ready drafts the user reviews and commits.
|
|
4
|
+
trigger:
|
|
5
|
+
- self-evolving memory
|
|
6
|
+
- skill proposals
|
|
7
|
+
- routing proposals
|
|
8
|
+
- memory feedback loop
|
|
9
|
+
- kodelyth evolve
|
|
10
|
+
- propose skill
|
|
11
|
+
- propose routing
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
# Skill: self-evolving-memory
|
|
15
|
+
|
|
16
|
+
## What this skill does
|
|
17
|
+
|
|
18
|
+
Closes the learning loop on the BM25 memory system. Two signals drive proposals:
|
|
19
|
+
|
|
20
|
+
| Signal | Source | Outcome when threshold hit |
|
|
21
|
+
|---|---|---|
|
|
22
|
+
| **Memory reuse** | Auto-recall hook bumps a counter every time a memory is surfaced to the user | Propose **promoting the memory to a draft `SKILL.md`** |
|
|
23
|
+
| **Routing miss** | Auto-recall hook logs substantive prompts where memory recall returned nothing | Propose **adding a routing entry** to `rules/common/agent-intent-routing.md` |
|
|
24
|
+
|
|
25
|
+
Both proposals are written to a local proposal log. **Nothing is ever auto-applied.** The user reviews, accepts (which writes a draft file), edits, and commits.
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
## When to use this skill
|
|
30
|
+
|
|
31
|
+
Use **explicitly** by name when:
|
|
32
|
+
|
|
33
|
+
- You've been running ECC for weeks and want to surface what the toolkit has learned about your work.
|
|
34
|
+
- A pattern keeps coming back in your sessions and you want to formalize it as a skill.
|
|
35
|
+
- You suspect there's a gap in the routing rule (you keep getting the wrong agent for a class of prompts).
|
|
36
|
+
- You want to inspect how the self-learning loop is doing without committing to anything.
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
use self-evolving-memory
|
|
40
|
+
|
|
41
|
+
# See what signals have been collected
|
|
42
|
+
npx kodelyth-ecc evolve stats
|
|
43
|
+
|
|
44
|
+
# Generate proposals from current signals
|
|
45
|
+
npx kodelyth-ecc evolve analyze
|
|
46
|
+
|
|
47
|
+
# Review what's pending
|
|
48
|
+
npx kodelyth-ecc evolve list
|
|
49
|
+
|
|
50
|
+
# Inspect a specific proposal end-to-end (incl. proposed file content)
|
|
51
|
+
npx kodelyth-ecc evolve show <proposalId>
|
|
52
|
+
|
|
53
|
+
# Accept → writes a draft file. NEVER auto-commits.
|
|
54
|
+
npx kodelyth-ecc evolve accept <proposalId>
|
|
55
|
+
|
|
56
|
+
# Reject — appends a state event with optional note
|
|
57
|
+
npx kodelyth-ecc evolve reject <proposalId> --note "covered by existing agent"
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Implicit triggers (the AI should route here automatically):
|
|
61
|
+
|
|
62
|
+
- "what has ECC learned from my sessions?"
|
|
63
|
+
- "promote this memory to a skill"
|
|
64
|
+
- "add this to the routing rule"
|
|
65
|
+
- "what's missing from the routing intent rule?"
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
## CLI surface
|
|
70
|
+
|
|
71
|
+
### `kodelyth-ecc evolve stats`
|
|
72
|
+
|
|
73
|
+
Snapshot of currently recorded signals:
|
|
74
|
+
|
|
75
|
+
- **Reuse:** memories tracked, total surfaces, top reused entries.
|
|
76
|
+
- **Routing misses:** total misses, unique prompts, top clusters.
|
|
77
|
+
|
|
78
|
+
### `kodelyth-ecc evolve analyze`
|
|
79
|
+
|
|
80
|
+
Reads signals + your `~/.kodelyth/memory/` store, applies thresholds, and writes proposals to `~/.kodelyth/evolve/proposals.jsonl`. Idempotent — re-running with the same evidence produces the same proposal IDs and does NOT duplicate.
|
|
81
|
+
|
|
82
|
+
| Flag | Default | Effect |
|
|
83
|
+
|---|---|---|
|
|
84
|
+
| `--reuse-min N` | 3 | Memory must have surfaced ≥ N times to be eligible |
|
|
85
|
+
| `--reuse-min-sessions N` | 2 | …across ≥ N distinct sessions |
|
|
86
|
+
| `--miss-min N` | 3 | A token cluster must have ≥ N total miss events |
|
|
87
|
+
| `--miss-min-distinct N` | 2 | …with ≥ N distinct prompts |
|
|
88
|
+
| `--json` | off | Stream the full report instead of the pretty summary |
|
|
89
|
+
|
|
90
|
+
### `kodelyth-ecc evolve list [--status pending|accepted|rejected|applied]`
|
|
91
|
+
|
|
92
|
+
Show proposals filtered by state. Proposals are append-only — every state change is a new event, full audit trail preserved.
|
|
93
|
+
|
|
94
|
+
### `kodelyth-ecc evolve show <id>`
|
|
95
|
+
|
|
96
|
+
Print the full proposed file content + evidence. **Always preview before accepting.**
|
|
97
|
+
|
|
98
|
+
### `kodelyth-ecc evolve accept <id> [--root DIR] [--overwrite]`
|
|
99
|
+
|
|
100
|
+
Writes the proposed `diff` to its `target_path` under `--root` (defaults to package root). **Refuses to overwrite an existing file** unless `--overwrite` is passed. After writing, marks the proposal `accepted` with the absolute `applied_path`.
|
|
101
|
+
|
|
102
|
+
The user must still review the draft, edit, and commit. The CLI does not stage or commit anything.
|
|
103
|
+
|
|
104
|
+
### `kodelyth-ecc evolve reject <id> [--note "..."]`
|
|
105
|
+
|
|
106
|
+
Marks a proposal `rejected`. Optional `--note` is preserved for the audit trail.
|
|
107
|
+
|
|
108
|
+
---
|
|
109
|
+
|
|
110
|
+
## How signals are recorded
|
|
111
|
+
|
|
112
|
+
The auto-recall hook (`hooks/memory/auto-recall.js`) does two things in addition to its normal job:
|
|
113
|
+
|
|
114
|
+
1. **On a memory surface** — calls `evolve.recordSurface({ memoryId, sessionId, projectRoot })`. This bumps the per-memory counter in `~/.kodelyth/evolve/reuse.json`. Idempotent per `(memoryId, sessionId)` — you can't game the counter by surfacing the same memory ten times in one session.
|
|
115
|
+
2. **On a substantive prompt with zero memory matches** — calls `evolve.recordRoutingMiss({ prompt, sessionId, projectRoot })`. Appends one line to `~/.kodelyth/evolve/routing-misses.jsonl`. The prompt is capped to 1000 chars and stored alongside its top tokens for clustering.
|
|
116
|
+
|
|
117
|
+
Both calls are **fire-and-forget**: any error is swallowed silently. The hook NEVER blocks recall on stats failure.
|
|
118
|
+
|
|
119
|
+
---
|
|
120
|
+
|
|
121
|
+
## How proposals are generated
|
|
122
|
+
|
|
123
|
+
`scripts/evolve/analyze.js` is pure, deterministic, no I/O.
|
|
124
|
+
|
|
125
|
+
**Skill upgrade** — for every memory whose reuse meets thresholds, build a draft `SKILL.md` from the memory's problem / approach / tags / language. Target path: `skills/<slug>/SKILL.md`.
|
|
126
|
+
|
|
127
|
+
**Routing addition** — cluster routing-miss entries by their top-K tokens (≥2-token overlap). For every cluster meeting thresholds, build a draft markdown block to add to `rules/common/agent-intent-routing.md`. Target path: the rule itself (the diff is meant to be merged in by hand under the right priority tier — the agent name in the draft is intentionally `TODO-agent`).
|
|
128
|
+
|
|
129
|
+
Proposal IDs are deterministic over their evidence — the same evidence always produces the same ID, so re-running `analyze` does not duplicate.
|
|
130
|
+
|
|
131
|
+
---
|
|
132
|
+
|
|
133
|
+
## Hard rules
|
|
134
|
+
|
|
135
|
+
1. **NEVER auto-apply.** `accept` writes a draft file. The user reviews, edits, and commits. No git operations.
|
|
136
|
+
2. **NEVER overwrite by default.** `accept` refuses to clobber an existing file unless `--overwrite` is explicit.
|
|
137
|
+
3. **NEVER block the recall hook.** All evolve recording is fire-and-forget with try/catch around every call.
|
|
138
|
+
4. **NEVER auto-route to a `TODO-agent` proposal.** The routing-addition diff intentionally names `TODO-agent` so accepting it cannot accidentally flip routing behavior. The user must rename + place it under the right priority tier.
|
|
139
|
+
5. **Idempotent IDs.** Re-running `analyze` does not duplicate proposals. Stable evidence → stable ID.
|
|
140
|
+
6. **Append-only proposal log.** Every state change is a new event. Full audit trail preserved.
|
|
141
|
+
|
|
142
|
+
---
|
|
143
|
+
|
|
144
|
+
## Pairing with other ECC features
|
|
145
|
+
|
|
146
|
+
| Pair with | What you get |
|
|
147
|
+
|---|---|
|
|
148
|
+
| **BM25 memory store** | Source of reuse signals. Without captured memories, this skill has nothing to learn from. |
|
|
149
|
+
| **`/memory remember`** | Manual capture. Explicitly captured memories that get reused → skill proposals. |
|
|
150
|
+
| **`rules/common/agent-intent-routing.md`** | The exact target for routing-addition proposals. |
|
|
151
|
+
| **Phase 2.7 swarm** | Repeated swarm tasks that surface the same memories → those memories become skills the swarm can pick automatically. |
|
|
152
|
+
| **Phase 2.8 replay** | Replay bundles can re-trigger reuse signals when the same memory is surfaced again. |
|
|
153
|
+
| **Phase 2.10 token-budget hook** | Promoting memories → skills means cheaper recalls (skills are loaded once, memories are recalled per-prompt). |
|
|
154
|
+
|
|
155
|
+
---
|
|
156
|
+
|
|
157
|
+
## Storage layout
|
|
158
|
+
|
|
159
|
+
```
|
|
160
|
+
~/.kodelyth/evolve/
|
|
161
|
+
├── reuse.json # per-memory reuse counters
|
|
162
|
+
├── routing-misses.jsonl # append-only miss log
|
|
163
|
+
└── proposals.jsonl # append-only proposal events
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
Override with `KODELYTH_EVOLVE_DIR`. All zero telemetry. All local.
|
|
167
|
+
|
|
168
|
+
---
|
|
169
|
+
|
|
170
|
+
## See also
|
|
171
|
+
|
|
172
|
+
- `commands/evolve.md` — `/evolve` slash command
|
|
173
|
+
- `docs/evolve.md` — full reference + worked example
|
|
174
|
+
- `scripts/evolve/{stats,analyze,proposals}.js` — pure-function implementation
|
|
175
|
+
- `hooks/memory/auto-recall.js` — signal capture (Phase 3.4 augmentation)
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: session-replay
|
|
3
|
+
description: Bundle, share, and re-run swarm sessions with optional variations (different harness, different agents, different base ref). Used for regression testing prompts, reproducible bug reports, A/B testing model versions, and post-mortems on swarm runs.
|
|
4
|
+
origin: ECC
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Session Replay — Reproducible Swarm Runs
|
|
8
|
+
|
|
9
|
+
Every swarm session writes to `<repo>/.orchestration/<session>/`. That directory is the **session record**: task prompts, agent handoffs, status markers. Replay turns it into a portable, re-runnable artifact.
|
|
10
|
+
|
|
11
|
+
> Phase 2.8 of the [Devil Roadmap](../../README.md). Pairs with the swarm orchestrator (Phase 2.7), the cost-aware model router (Phase 2.4), and the token-budget safety hook (Phase 2.10).
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## When to invoke
|
|
16
|
+
|
|
17
|
+
Trigger this skill when the user wants to:
|
|
18
|
+
|
|
19
|
+
- **Reproduce a swarm run** with different settings (different model, different agent, different base ref).
|
|
20
|
+
- **Share a swarm result** with a teammate as a single JSON file (no need to ship a whole repo).
|
|
21
|
+
- **Compare runs** — same task, two harnesses, side-by-side handoff diff.
|
|
22
|
+
- **Regression-test prompts** — replay a known-good swarm against a new agent rev to see if quality regressed.
|
|
23
|
+
- **Build a reproducible bug report** — bundle a buggy run and ship to maintainers.
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## Three primitives
|
|
28
|
+
|
|
29
|
+
### 1. Export a session
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
npx kodelyth-ecc session-export swarm-2026-05-10-4a \
|
|
33
|
+
--task "audit oauth flow for security regressions" \
|
|
34
|
+
--agents security-reviewer,code-reviewer,pair-programmer,tdd-guide \
|
|
35
|
+
--harness claude \
|
|
36
|
+
--out ~/Desktop/oauth-audit.bundle.json
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
The `--task` / `--agents` / `--harness` / `--base-ref` flags enrich the bundle's `meta` block for richer replays. They're optional — without them, the bundle still works but replays default to whatever the bundle's first worker hint reveals.
|
|
40
|
+
|
|
41
|
+
### 2. Import a bundle
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
npx kodelyth-ecc session-import ~/Desktop/oauth-audit.bundle.json
|
|
45
|
+
# or:
|
|
46
|
+
npx kodelyth-ecc session-import oauth-audit.bundle.json --target /tmp/audit-restore --overwrite
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Restores the bundle into a coordination directory. Useful for inspecting handoffs locally before replaying.
|
|
50
|
+
|
|
51
|
+
### 3. Replay a session
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
# By bundle file
|
|
55
|
+
npx kodelyth-ecc replay oauth-audit.bundle.json --execute
|
|
56
|
+
|
|
57
|
+
# By session name (in current repo's .orchestration/)
|
|
58
|
+
npx kodelyth-ecc replay swarm-2026-05-10-4a --execute
|
|
59
|
+
|
|
60
|
+
# A/B variation: same task, different harness
|
|
61
|
+
npx kodelyth-ecc replay oauth-audit.bundle.json --harness codex --execute
|
|
62
|
+
|
|
63
|
+
# A/B variation: different agent set
|
|
64
|
+
npx kodelyth-ecc replay oauth-audit.bundle.json \
|
|
65
|
+
--agents security-reviewer,supply-chain-auditor,prompt-injection-hunter \
|
|
66
|
+
--execute
|
|
67
|
+
|
|
68
|
+
# Replay against new code
|
|
69
|
+
npx kodelyth-ecc replay oauth-audit.bundle.json --base-ref refactor/oauth-rewrite --execute
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Default mode is **dry-run**. Pass `--execute` to actually spawn worktrees + tmux + agents. The replay session is auto-named `<original>-replay-<n>` so it never collides with the source.
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
## Bundle format
|
|
77
|
+
|
|
78
|
+
Single JSON file. Stable schema `kodelyth.session-bundle/v1`:
|
|
79
|
+
|
|
80
|
+
```json
|
|
81
|
+
{
|
|
82
|
+
"schema": "kodelyth.session-bundle/v1",
|
|
83
|
+
"session": "swarm-2026-05-10-4a",
|
|
84
|
+
"exported_at": "2026-05-10T17:30:00Z",
|
|
85
|
+
"exported_by": "kodelyth-ecc@1.7.0",
|
|
86
|
+
"meta": {
|
|
87
|
+
"task": "audit oauth flow for security regressions",
|
|
88
|
+
"agents": ["security-reviewer", "code-reviewer", "pair-programmer", "tdd-guide"],
|
|
89
|
+
"harness": "claude",
|
|
90
|
+
"base_ref": "HEAD"
|
|
91
|
+
},
|
|
92
|
+
"workers": [
|
|
93
|
+
{ "slug": "code-reviewer", "task": "...", "handoff": "...", "status": "..." },
|
|
94
|
+
{ "slug": "pair-programmer", "task": "...", "handoff": "...", "status": "..." },
|
|
95
|
+
{ "slug": "security-reviewer", "task": "...", "handoff": "...", "status": "..." },
|
|
96
|
+
{ "slug": "tdd-guide", "task": "...", "handoff": "...", "status": "..." }
|
|
97
|
+
]
|
|
98
|
+
}
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Pure JSON. No archives, no binaries. Diff-friendly for git review of regression bundles.
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
## Replay variations matrix
|
|
106
|
+
|
|
107
|
+
| Want to test | Flags |
|
|
108
|
+
|---|---|
|
|
109
|
+
| Same task, different model | `--harness claude` vs `--harness codex` (or use `KODELYTH_ROUTER_*` env vars) |
|
|
110
|
+
| Same task, different agents | `--agents new1,new2,new3` |
|
|
111
|
+
| Same task, new code | `--base-ref refactor-branch` |
|
|
112
|
+
| Same task, custom session name | `--session my-replay-1` |
|
|
113
|
+
| Inspect plan only | (default — dry-run prints plan) |
|
|
114
|
+
| Just write coordination files | `--write-only` |
|
|
115
|
+
| Full execute | `--execute` |
|
|
116
|
+
|
|
117
|
+
---
|
|
118
|
+
|
|
119
|
+
## Hard rules
|
|
120
|
+
|
|
121
|
+
1. **Never replay with `--execute` without inspecting the dry-run first.** Worktrees mutate disk; bad replays waste storage.
|
|
122
|
+
2. **Replays are auto-named** to avoid collisions. Don't manually reuse the origin name.
|
|
123
|
+
3. **Bundles are public artifacts** — strip secrets from `task.md` / `handoff.md` before sharing externally. Use `opensource-sanitizer` if needed.
|
|
124
|
+
4. **A/B comparisons require human review.** Never auto-pick a "winner" between two replays.
|
|
125
|
+
|
|
126
|
+
---
|
|
127
|
+
|
|
128
|
+
## Pairing with the rest of ECC
|
|
129
|
+
|
|
130
|
+
| Pairs with | How |
|
|
131
|
+
|---|---|
|
|
132
|
+
| **2.7 swarm orchestrator** | Replay only works on swarm coordination dirs. The two ship together. |
|
|
133
|
+
| **2.4 cost router** | Vary `KODELYTH_ROUTER_*` env vars across replays for A/B model tests. |
|
|
134
|
+
| **2.10 token-budget hook** | Replays open new sessions with fresh budgets — no spillover from the origin. |
|
|
135
|
+
| **2.5 MCP client mode** | Replays inherit the same MCP registry, so tool calls reproduce. |
|
|
136
|
+
| **opensource-sanitizer** | Run on a bundle before sharing externally. |
|
|
137
|
+
| **kodelyth-memory** | Capture the bundle path as a memory: `kodelyth-ecc remember "oauth audit replay" --approach "..."`. |
|
|
138
|
+
|
|
139
|
+
---
|
|
140
|
+
|
|
141
|
+
## Examples
|
|
142
|
+
|
|
143
|
+
### Bug report bundle
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
# 1. Capture the buggy run
|
|
147
|
+
npx kodelyth-ecc swarm --task "..." --execute
|
|
148
|
+
|
|
149
|
+
# 2. After it finishes, export
|
|
150
|
+
npx kodelyth-ecc session-export swarm-2026-05-10-4a --out bug-report.bundle.json
|
|
151
|
+
|
|
152
|
+
# 3. Strip secrets if needed
|
|
153
|
+
# (manually edit bug-report.bundle.json or use opensource-sanitizer)
|
|
154
|
+
|
|
155
|
+
# 4. Ship to maintainers
|
|
156
|
+
gh issue create --body "Reproducer: bug-report.bundle.json (attached)"
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
### Model A/B test
|
|
160
|
+
|
|
161
|
+
```bash
|
|
162
|
+
# Run with claude
|
|
163
|
+
npx kodelyth-ecc swarm --task "refactor payments module" --agents 4 --harness claude --execute
|
|
164
|
+
npx kodelyth-ecc session-export swarm-... --out claude-run.bundle.json
|
|
165
|
+
|
|
166
|
+
# Replay with codex against the same task
|
|
167
|
+
npx kodelyth-ecc replay claude-run.bundle.json --harness codex --execute
|
|
168
|
+
npx kodelyth-ecc session-export swarm-...-replay-1 --out codex-run.bundle.json
|
|
169
|
+
|
|
170
|
+
# Compare handoffs side-by-side
|
|
171
|
+
diff <(jq -r '.workers[] | "\(.slug):\n\(.handoff)"' claude-run.bundle.json) \
|
|
172
|
+
<(jq -r '.workers[] | "\(.slug):\n\(.handoff)"' codex-run.bundle.json)
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
### Regression check after agent rev
|
|
176
|
+
|
|
177
|
+
```bash
|
|
178
|
+
# 1. Save a known-good run as a baseline.
|
|
179
|
+
npx kodelyth-ecc session-export swarm-baseline --out baseline.bundle.json
|
|
180
|
+
|
|
181
|
+
# 2. After updating an agent prompt, replay and compare.
|
|
182
|
+
npx kodelyth-ecc replay baseline.bundle.json --execute
|
|
183
|
+
npx kodelyth-ecc session-export swarm-baseline-replay-1 --out replay.bundle.json
|
|
184
|
+
# Inspect the diff manually — has quality regressed?
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
---
|
|
188
|
+
|
|
189
|
+
## Implementation references
|
|
190
|
+
|
|
191
|
+
- Bundle library: `scripts/replay/bundle.js` (pure read/write, validation, diff helper).
|
|
192
|
+
- Replay engine: `scripts/replay/replay.js` (extracts task from bundle, builds replay plan-config).
|
|
193
|
+
- CLI: `npx kodelyth-ecc session-export | session-import | replay`.
|
|
194
|
+
- Slash command: `/replay`.
|
|
195
|
+
- Full reference: `docs/replay.md`.
|
|
196
|
+
|
|
197
|
+
---
|
|
198
|
+
|
|
199
|
+
Built into [Kodelyth ECC](../../README.md). MIT licensed.
|