@precisionutilityguild/liquid-shadow 1.0.9 → 1.0.11

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 (41) hide show
  1. package/README.md +279 -62
  2. package/dist/data/migrations/000_baseline.sql +17 -0
  3. package/dist/data/migrations/014_tribunal_state.sql +24 -0
  4. package/dist/data/migrations/015_repo_level_handoffs_nullable.sql +52 -0
  5. package/dist/data/migrations/016_repair_tribunal_artifact_fk.sql +58 -0
  6. package/dist/entry/cli/index.js +1296 -928
  7. package/dist/entry/ember/index.js +313 -254
  8. package/dist/entry/mcp/server.js +1031 -808
  9. package/dist/entry/tribunal/index.js +685 -0
  10. package/dist/index.js +1008 -785
  11. package/dist/logic/domain/embeddings/worker.js +1 -1
  12. package/dist/logic/parser/index.js +16 -16
  13. package/dist/logic/parser/worker.js +1 -1
  14. package/dist/skills/shadow_audit/SKILL.md +22 -30
  15. package/dist/skills/shadow_chronicle/SKILL.md +16 -29
  16. package/dist/skills/shadow_continue/SKILL.md +37 -53
  17. package/dist/skills/shadow_coordinate/SKILL.md +46 -0
  18. package/dist/skills/shadow_crystallize/SKILL.md +13 -27
  19. package/dist/skills/shadow_mission/SKILL.md +27 -41
  20. package/dist/skills/shadow_onboard/SKILL.md +26 -35
  21. package/dist/skills/shadow_research/SKILL.md +15 -23
  22. package/dist/skills/shadow_sync/SKILL.md +18 -9
  23. package/dist/skills/shadow_synthesize/SKILL.md +14 -36
  24. package/dist/skills/shadow_trace_impact/SKILL.md +30 -50
  25. package/dist/skills/shadow_understand/SKILL.md +37 -52
  26. package/dist/skills/shadow_workspace/SKILL.md +44 -22
  27. package/dist/web-manifest.json +18 -7
  28. package/package.json +2 -1
  29. package/skills/shadow_audit/SKILL.md +22 -30
  30. package/skills/shadow_chronicle/SKILL.md +16 -29
  31. package/skills/shadow_continue/SKILL.md +37 -53
  32. package/skills/shadow_coordinate/SKILL.md +46 -0
  33. package/skills/shadow_crystallize/SKILL.md +13 -27
  34. package/skills/shadow_mission/SKILL.md +27 -41
  35. package/skills/shadow_onboard/SKILL.md +26 -35
  36. package/skills/shadow_research/SKILL.md +15 -23
  37. package/skills/shadow_sync/SKILL.md +18 -9
  38. package/skills/shadow_synthesize/SKILL.md +14 -36
  39. package/skills/shadow_trace_impact/SKILL.md +30 -50
  40. package/skills/shadow_understand/SKILL.md +37 -52
  41. package/skills/shadow_workspace/SKILL.md +44 -22
package/README.md CHANGED
@@ -1,119 +1,336 @@
1
- # 🌑 Liquid Shadow
1
+ <p align="center">
2
+ <img src="https://img.shields.io/badge/%F0%9F%8C%91_Liquid_Shadow-MCP_Intelligence_Layer-6D28D9?style=for-the-badge" alt="Liquid Shadow">
3
+ </p>
4
+
5
+ <h1 align="center">Liquid Shadow</h1>
2
6
 
3
7
  <p align="center">
4
- <b>Tactical Repository Intelligence Operative - The AI-First Intelligence Layer</b><br>
5
- <i>Transform your codebase into a high-signal knowledge graph built for reasoning.</i>
8
+ <strong>The AI-First Code Intelligence Layer for MCP Agents</strong><br>
9
+ Stop making your agents grep. Give them a brain.
6
10
  </p>
7
11
 
8
12
  <p align="center">
9
- <img src="https://img.shields.io/badge/version-1.0.9-blue.svg" alt="Version">
10
- <img src="https://img.shields.io/badge/License-Apache--2.0-blue.svg" alt="License">
11
- <img src="https://img.shields.io/badge/build-passing-brightgreen.svg" alt="Build">
12
- <img src="https://img.shields.io/badge/MCP-First-6D28D9.svg" alt="MCP First">
13
+ <a href="https://www.npmjs.com/package/@precisionutilityguild/liquid-shadow"><img src="https://img.shields.io/npm/v/@precisionutilityguild/liquid-shadow?color=6D28D9&label=npm" alt="npm version"></a>
14
+ <img src="https://img.shields.io/badge/MCP-Compatible-10B981.svg" alt="MCP Compatible">
15
+ <img src="https://img.shields.io/badge/Tools-52_Atomic-F59E0B.svg" alt="52 Tools">
16
+ <img src="https://img.shields.io/badge/Languages-TS%20%7C%20JS%20%7C%20Python%20%7C%20PHP%20%7C%20Go-3B82F6.svg" alt="Languages">
17
+ <img src="https://img.shields.io/badge/License-Apache--2.0-gray.svg" alt="License">
13
18
  </p>
14
19
 
15
20
  ---
16
21
 
17
- ## The AI-Native Intelligence OS
22
+ ## The Problem With How Agents Work Today
23
+
24
+ Every time your AI agent needs to understand a codebase, it does this:
25
+
26
+ ```
27
+ read file → grep → read another file → grep → read another file...
28
+ ```
18
29
 
19
- **Liquid Shadow** is the primary bridge between your reasoning engine and the raw filesystem. It doesn't just "index" code; it builds a **Relational Intelligence Graph** that allows AI agents to navigate, reason about, and modify large-scale repositories with surgical precision and extreme token efficiency.
30
+ That's hundreds of tokens, dozens of tool calls, and a reasoning chain that collapses under its own weight for anything larger than a toy project. The agent never builds a real mental model it just stumbles through the dark.
20
31
 
21
- Stop forcing your agents to grep through files. Give them the ability to "feel" the architecture through topological maps and execution flows.
32
+ **Liquid Shadow fixes this at the architecture level.**
22
33
 
23
34
  ---
24
35
 
25
- ## Product Pillars
36
+ ## What It Is
26
37
 
27
- ### Semantic Sieve & Token Efficiency
38
+ Liquid Shadow is a **Model Context Protocol (MCP) server** that builds a persistent **Relational Intelligence Graph** of your codebase — symbols, dependencies, types, execution flows, git history — and exposes it as 52 high-signal atomic tools your agents can use instead of file reads and grep.
28
39
 
29
- Context is the most expensive resource. Our **Semantic Sieve** intelligently folds implementation details, revealing only the signatures and intent your agent needs. With **Briefing Zoom Levels** (`Orbit`, `Atmosphere`, `Ground`), you control exactly how many tokens are consumed based on the task's altitude.
40
+ One `shadow_analyze_flow` call returns the entire execution graph from an entrypoint.
41
+ One `shadow_analyze_impact` call shows the full blast radius before a change.
42
+ One `shadow_ops_briefing` call resumes mission context across sessions.
30
43
 
31
- ### Nano-Repair & Structural Stability
44
+ This isn't a smarter `grep`. It's a different paradigm entirely.
32
45
 
33
- Repositories are liquid. Code moves, files are renamed, and dependencies shift. **Nano-Repair** auto-heals your intelligence index in real-time, ensuring that "intent links" and architectural context survive even the most aggressive refactors.
46
+ ---
34
47
 
35
- ### Mission-Driven Development
48
+ ## What It Actually Does
36
49
 
37
- We treat development as a series of tactical **Missions**. Liquid Shadow records every architectural decision (ADR), discovery, and blocker as it happens, creating a persistent "Chronome" of project narrative that persists across sessions.
50
+ ### 🔍 Semantic Code Discovery
51
+ Natural language search across your entire codebase. Find "authentication logic" — not just files with `auth` in the name. Powered by hybrid **vector + BM25 FTS** search with Reciprocal Rank Fusion scoring.
38
52
 
39
- ### Relational Impact Analysis
53
+ ### 📊 Relational Graph Analysis
54
+ Trace full execution flows. Compute blast radius of any change. Resolve type inheritance chains. Map every HTTP route, socket event, and pubsub topic — producers and consumers split.
40
55
 
41
- Change one function, see the ripple. Trace execution flows and predict the **Blast Radius** of any modification across repository boundaries using our cross-repo fusion engine.
56
+ ### 🧠 Token-Optimized Inspection
57
+ The **Semantic Sieve** folds implementation details and surfaces only signatures and intent. Control depth with `Orbit → Atmosphere → Ground` zoom levels. A file summary costs ~20 tokens instead of 2,000.
42
58
 
43
- ---
59
+ ### 🎯 Mission-Driven Development
60
+ Persistent context that **survives across sessions**. Create missions with outcome contracts, log decisions and discoveries, synthesize Architectural Decision Records, and resume exactly where you left off — even weeks later.
44
61
 
45
- ## The Tactical Suite (43 Atomic Tools)
62
+ ### 🤝 Multi-Agent Coordination
63
+ File-level **claim/release locking** prevents parallel agents from stomping on each other's work. Dispatch plans across agent roles. Submit findings to a peer-review Tribunal. Hand off typed artifacts between RECON → OVERSEER → ENGINEER pipelines.
46
64
 
47
- Organized into specialized intelligence suites for the modern agent:
65
+ ### 🔧 Zero-Maintenance Indexing
66
+ Git hooks auto-reindex on every commit and branch switch. The **Ember Daemon** builds semantic embeddings in the background at lowest OS priority — your `git commit` is never blocked.
48
67
 
49
- | Suite | Tactical Purpose | Key Tools |
50
- | :--------------- | :------------------------------ | :------------------------------------------------- |
51
- | **Ops Control** | Mission & context management | `shadow_ops_context`, `shadow_ops_briefing` |
52
- | **Intelligence** | Deep architectural reasoning | `shadow_analyze_impact`, `shadow_analyze_flow` |
53
- | **Discovery** | Semantic & config retrieval | `shadow_search_concept`, `shadow_search_config` |
54
- | **Recon** | Structural layer classification | `shadow_recon_topography`, `shadow_recon_hologram` |
55
- | **Inspection** | Token-optimized code folding | `shadow_inspect_symbol`, `shadow_inspect_file` |
56
- | **Maintenance** | Intelligence synchronization | `shadow_sync_trace`, `shadow_sync_repair` |
68
+ ### 🌐 Cross-Repo Intelligence
69
+ The **Fused Index** unifies multiple repositories at query time via SQLite `ATTACH DATABASE`. Zero data duplication. Trace a frontend API call all the way through to the backend handler across repo boundaries.
57
70
 
58
71
  ---
59
72
 
60
- ## The Intelligence Lifecycle
73
+ ## Tool Suite (52 Atomic Tools)
74
+
75
+ | Suite | Tools | Purpose |
76
+ |:------|:------|:--------|
77
+ | **`shadow_recon_*`** | `onboard` `topography` `scout` `tree` `hologram` | Bootstrap index, structural classification, arc maps |
78
+ | **`shadow_search_*`** | `concept` `symbol` `config` `path` | Semantic, symbol, env var, and path searches |
79
+ | **`shadow_analyze_*`** | `impact` `flow` `deps` `mesh` `type_graph` `debt` `explain_diff` | Blast radius, execution flows, API surfaces, dead code, diff narratives |
80
+ | **`shadow_inspect_*`** | `symbol` `file` | Token-folded symbol inspection and file summaries |
81
+ | **`shadow_ops_*`** | `plan` `track` `log` `briefing` `context` `synthesize` `chronicle` `health` `graph` `crystallize` `crystallize_theme` `claim` `release` `dispatch_plan` `tribunal_submit` `tribunal_status` `handoff` `handoff_read` | Full mission lifecycle + multi-agent coordination |
82
+ | **`shadow_sync_*`** | `trace` `index` `repair` | Incremental sync, Nano-Repair auto-healing |
83
+ | **`shadow_env_*`** | `hooks` `diagnose` | Git hook management, system health |
84
+ | **`shadow_workspace_*`** | `list` `link` `fuse` `status` `ensure` `repair` `gc` | Multi-repo Federation |
85
+
86
+ ---
61
87
 
62
- Liquid Shadow is designed to be the first point of contact for any agent entering a workspace.
88
+ ## Zero-Config Setup (2 Minutes)
63
89
 
64
- ### 1. Installation (Safe Init)
90
+ Stop configuring things manually. Liquid Shadow auto-discovers your IDE and injects both the MCP server and the Tactical Skills so your agent is instantly operational.
65
91
 
66
92
  ```bash
67
- npm install -g @precisionutilityguild/liquid-shadow
68
- liquid-shadow init # Interactive security confirmation
93
+ # 1. Install globally
94
+ npm i -g @precisionutilityguild/liquid-shadow
95
+
96
+ # 2. Run the tactical onboarding
97
+ liquid-shadow init
69
98
  ```
70
99
 
71
- ### 2. Operational Dashboard (TUI)
100
+ The `init` script automatically configures MCP connections for:
101
+ - ✅ **Claude Code** (`~/.claude.json`)
102
+ - ✅ **Claude Desktop** (`claude_desktop_config.json`)
103
+ - ✅ **Gemini CLI** (`~/.gemini/settings.json`)
104
+ - ✅ **Antigravity IDE** (`mcp_config.json`)
105
+ - ✅ **Cursor** (via `.cursor/mcp.json` context)
106
+ - ✅ **Codex** (`~/.codex/config.toml`)
72
107
 
73
- Keep a finger on the pulse of your repository's intelligence. Liquid Shadow provides a high-signal Terminal UI for a bird's-eye view of your mapping density and performance.
108
+ *(If you are using an unsupported client, simply point it to `liquid-shadow-mcp` with no arguments).*
74
109
 
75
- ```bash
76
- liquid-shadow dashboard
110
+ ---
111
+
112
+ ## First Run: Onboard Your Repository
113
+
114
+ Once connected, tell your agent:
115
+
116
+ ```
117
+ Use shadow_recon_onboard on /absolute/path/to/your/repo
118
+ ```
119
+
120
+ Liquid Shadow scans all source files, extracts symbols, builds dependency graphs, and fires up the Ember Daemon for background embedding generation. Most mid-size projects are ready in under 30 seconds.
121
+
122
+ ---
123
+
124
+ ## The Skills System
125
+
126
+ Liquid Shadow ships **14 pre-built agent workflows** (called Skills) that are automatically injected into your agent's context on `init`. Instead of calling raw tools and guessing at the right sequence, agents follow optimized tactical playbooks.
127
+
128
+ | Skill | What It Does |
129
+ |:------|:-------------|
130
+ | `/onboard` | Bootstrap index, hooks, and first mission |
131
+ | `/understand` | Concept-to-code mapping and execution tracing |
132
+ | `/mission` | Strategic planning with outcome contracts |
133
+ | `/continue` | Resume the highest-priority active mission |
134
+ | `/trace-impact` | Blast radius and cross-repo dependency maps |
135
+ | `/audit` | Dead code, circular deps, layer drift detection |
136
+ | `/chronicle` | Git-native narrative history of the project |
137
+ | `/synthesize` | Distill mission logs into Architectural Decision Records |
138
+ | `/research` | External dependency research with local + web context |
139
+ | `/workspace` | Multi-repo federation and mission linking |
140
+ | `/crystallize` | Compress mission logs for token-efficient briefings |
141
+ | `/coordinate` | Multi-agent dispatch and Tribunal reviews |
142
+ | `/sync` | Incremental index repair after external changes |
143
+
144
+ Skills reduce "what tools do I call in what order?" from a guessing game to a single directive.
145
+
146
+ ---
147
+
148
+ ## Real Usage Patterns
149
+
150
+ ### "What breaks if I change this function?"
151
+
152
+ ```
153
+ Use shadow_analyze_impact on the authenticateUser function in src/auth/service.ts
154
+ ```
155
+
156
+ Returns: every downstream consumer, call depth by default = 3, with file paths and symbol names. Blast radius computed in one call.
157
+
158
+ ### "Where is the auth logic?"
159
+
160
+ ```
161
+ Use shadow_search_concept to find all authentication and session handling code
162
+ ```
163
+
164
+ Returns: semantically ranked results. Finds code that *handles auth* even if it doesn't have `auth` in the filename.
165
+
166
+ ### "Explain what changed in this diff"
167
+
168
+ ```
169
+ Use shadow_analyze_explain_diff with staged:true
170
+ ```
171
+
172
+ Returns: a semantic narrative of what your current staged changes actually do — not just a list of lines changed.
173
+
174
+ ### "Resume where I left off"
175
+
176
+ ```
177
+ Use shadow_ops_briefing on /path/to/repo at Ground altitude
178
+ ```
179
+
180
+ Returns: active missions, next candidates, recent decisions, health stats — full context reconstruction from persistent storage.
181
+
182
+ ### "Find all API endpoints in this service"
183
+
184
+ ```
185
+ Use shadow_analyze_mesh on /path/to/repo with topic "/api/"
77
186
  ```
78
187
 
79
- > **Scouting Report**: Need a quick status instead? Run `liquid-shadow status`.
188
+ Returns: every HTTP route, socket event handler, and pubsub topic — producers and consumers mapped separately.
189
+
190
+ ---
80
191
 
81
- ### 3. The Skills-First Loop
192
+ ## Performance
82
193
 
83
- Liquid Shadow is designed for **Autonomy**. While it provides 43 atomic tools, the primary interface for an agent is the **Skills** system. Running `liquid-shadow init` automatically injects these high-level workflows into the agent's environment.
194
+ Indexing is CPU-parallel via SWC worker pools. Semantic embeddings are off-thread via the Ember Daemon.
84
195
 
85
- #### High-Signal Workflows
196
+ | Repository | Files | Symbols | Time |
197
+ |:-----------|:------|:--------|:-----|
198
+ | VS Code core | 6,100 | 109,000+ | 110.6s |
199
+ | Next.js | 9,700 | — | 24.2s (~400 files/sec) |
200
+ | Django | 2,893 | — | validated |
201
+ | Laravel Framework | 2,854 | — | validated |
202
+ | FastAPI | 1,118 | — | validated |
86
203
 
87
- Instead of guessing which tools to call, agents follow optimized **Tactical Skills**:
204
+ After the first index, incremental syncs typically complete in 1–3 seconds.
88
205
 
89
- - **/onboard**: Build the baseline index and topography.
90
- - **/understand**: Concept-to-code mapping and execution tracing.
91
- - **/mission**: Strategic planning and automated ADR synthesis.
92
- - **/trace-impact**: Predict blast radius and dependency ripple effects.
93
- - **/audit**: Detect technical debt, circular deps, and dead code.
206
+ ---
94
207
 
95
- #### Example: Agent Strategy Flow
208
+ ## CLI Reference
96
209
 
97
- ```markdown
98
- // 1. RECON: The agent reads the Skill definition
99
- view_file({ path: '.agent/skills/onboard/SKILL.md' });
210
+ For direct terminal use without an agent:
100
211
 
101
- // 2. ACT: Following the Skill, the agent orchestrates the tools
102
- shadow_recon_onboard({ repoPath: '/abs/path' });
103
- shadow_ops_context({ repoPath: '/abs/path' });
104
- shadow_env_hooks({ action: 'install', repoPath: '/abs/path' });
212
+ ```bash
213
+ # Initialize the intelligence index
214
+ npx @precisionutilityguild/liquid-shadow index /path/to/repo
215
+
216
+ # Real-time dashboard
217
+ npx @precisionutilityguild/liquid-shadow dashboard
218
+
219
+ # Quick status
220
+ npx @precisionutilityguild/liquid-shadow status /path/to/repo
221
+
222
+ # Symbol inspection
223
+ npx @precisionutilityguild/liquid-shadow inspect symbol /path/to/repo MyClass
224
+
225
+ # Mission management
226
+ npx @precisionutilityguild/liquid-shadow mission plan /path/to/repo "Migrate Auth" "Replace JWT with OAuth2"
227
+ npx @precisionutilityguild/liquid-shadow mission briefing /path/to/repo
228
+ npx @precisionutilityguild/liquid-shadow mission synthesize /path/to/repo <mission-id>
229
+
230
+ # Semantic search
231
+ npx @precisionutilityguild/liquid-shadow search-concept "authentication middleware"
232
+
233
+ # Deploy/update skills to all detected agents
234
+ npx @precisionutilityguild/liquid-shadow skills update
235
+
236
+ # Git hooks (auto-reindex on commit + branch switch)
237
+ npx @precisionutilityguild/liquid-shadow hooks install
105
238
  ```
106
239
 
107
240
  ---
108
241
 
109
- ## Enterprise-Grade Performance
242
+ ## Supported Languages
110
243
 
111
- Optimized for speed. Scalable for large codebases.
244
+ | Language | Parser | Status |
245
+ |:---------|:-------|:-------|
246
+ | TypeScript | SWC | ✅ Full |
247
+ | JavaScript | SWC | ✅ Full |
248
+ | Python | Tree-sitter | ✅ Full |
249
+ | PHP | Tree-sitter | ✅ Full |
250
+ | Go | Tree-sitter | ✅ Full |
112
251
 
113
- - **VS Code Core (6.1k files)**: Indexed in **110.6s** (109k+ symbols)
114
- - **Next.js (9.7k files)**: Indexed in **24.2s** (~404 files/sec)
252
+ More languages are added via Tree-sitter grammars. The parser is auto-selected from file extension.
253
+
254
+ ---
255
+
256
+ ## Architecture at a Glance
257
+
258
+ ```
259
+ Your Agent (Claude / Cursor / Gemini / etc.)
260
+
261
+ │ MCP stdio transport
262
+
263
+ ┌─────────────────────────────────────────┐
264
+ │ Liquid Shadow MCP Server │
265
+ │ 52 atomic tools across 8 suites │
266
+ │ │
267
+ │ ┌──────────┐ ┌──────────────────────┐ │
268
+ │ │ Recon │ │ Intelligence Engine │ │
269
+ │ │ Layer │ │ (Impact/Flow/Mesh) │ │
270
+ │ └────┬─────┘ └──────────┬───────────┘ │
271
+ │ │ │ │
272
+ │ ┌────▼───────────────────▼───────────┐ │
273
+ │ │ SQLite FTS5 + Vector Index │ │
274
+ │ │ (Symbols · Deps · Embeddings) │ │
275
+ │ └────────────────────────────────────┘ │
276
+ │ │
277
+ │ ┌──────────────┐ ┌────────────────┐ │
278
+ │ │ Mission Store│ │ Ember Daemon │ │
279
+ │ │ (Git Notes) │ │ (bg embeddings)│ │
280
+ │ └──────────────┘ └────────────────┘ │
281
+ └─────────────────────────────────────────┘
282
+
283
+
284
+ Your Repository (read-only — never modifies source)
285
+ ```
286
+
287
+ Liquid Shadow is **fully read-only** on your source code. It maintains its own SQLite index alongside your repository.
288
+
289
+ ---
290
+
291
+ ## Multi-Agent & Parallel Safety
292
+
293
+ Running multiple agents on the same codebase simultaneously? Liquid Shadow handles it:
294
+
295
+ - **`shadow_ops_claim`** — agent claims a file before editing
296
+ - **`shadow_ops_release`** — releases the claim after
297
+ - **`shadow_working_set_check`** — query active claims before spawning parallel workers
298
+ - **`shadow_ops_dispatch_plan`** — assign sub-missions to specialized agent roles
299
+ - **`shadow_ops_tribunal_submit/status`** — peer-review findings before merging conclusions
300
+
301
+ Claim entries are TTL-based and auto-expire, so a crashed agent never permanently blocks a file.
302
+
303
+ ---
304
+
305
+ ## Frequently Asked Questions
306
+
307
+ **Does Liquid Shadow modify my source code?**
308
+ Never. It is strictly read-only on your codebase. The only files it writes are its own SQLite index and Git Notes for mission logs.
309
+
310
+ **How do I keep the index fresh?**
311
+ You don't have to. Every tool automatically runs a JIT (Just-In-Time) git-tree differential check before executing. If you've modified files since the last index, it incrementally syncs only the changed files in milliseconds before answering your query. (You can also install Git hooks via `shadow_env_hooks` for background syncing).
312
+
313
+ **What if I rename files or move symbols?**
314
+ Run `shadow_sync_repair`. Nano-Repair re-links anchors and heals broken intent references without a full re-index.
315
+
316
+ **Can I use this as a library (not MCP)?**
317
+ Yes. The programmatic API (`query.ts`) exposes `searchSymbol`, `analyzeImpact`, and `getBriefing` as direct TypeScript entry-points.
318
+
319
+ **Does it work offline / on private code?**
320
+ Yes. Everything runs locally. No source code is sent anywhere. Embeddings are generated locally via `@xenova/transformers`.
321
+
322
+ ---
323
+
324
+ ## Links
325
+
326
+ - **Homepage**: [liquidshadow.pugcorp.online](https://liquidshadow.pugcorp.online/)
327
+ - **npm**: [@precisionutilityguild/liquid-shadow](https://www.npmjs.com/package/@precisionutilityguild/liquid-shadow)
328
+ - **GitHub**: [PrecisionUtilityGuild/liquid-shadow](https://github.com/PrecisionUtilityGuild/liquid-shadow)
329
+ - **Changelog**: [CHANGELOG.md](./CHANGELOG.md)
115
330
 
116
331
  ---
117
332
 
118
333
  <p align="center">
119
- <i>Powered by <b>SQLite FTS5</b>, <b>SWC</b>, and <b>Precision Intelligence</b>.</i><br>
334
+ Built on <b>SQLite FTS5</b> · <b>SWC</b> · <b>Tree-sitter</b> · <b>@xenova/transformers</b><br>
335
+ <i>Precision Utility Guild — making agents smarter, not louder.</i>
336
+ </p>
@@ -257,6 +257,23 @@ INSERT OR IGNORE INTO ember_state (key, value) VALUES ('started_at', NULL);
257
257
  INSERT OR IGNORE INTO ember_state (key, value) VALUES ('pid', NULL);
258
258
  INSERT OR IGNORE INTO ember_state (key, value) VALUES ('repo_path', NULL);
259
259
 
260
+ CREATE TABLE IF NOT EXISTS tribunal_state (
261
+ session_id TEXT PRIMARY KEY,
262
+ mission_id INTEGER,
263
+ repo_path TEXT NOT NULL,
264
+ status TEXT DEFAULT 'running',
265
+ phase TEXT DEFAULT 'initializing',
266
+ pid INTEGER,
267
+ artifact_id INTEGER,
268
+ started_at REAL DEFAULT (unixepoch()),
269
+ completed_at REAL,
270
+ FOREIGN KEY(mission_id) REFERENCES missions(id) ON DELETE SET NULL,
271
+ FOREIGN KEY(artifact_id) REFERENCES mission_artifacts(id) ON DELETE SET NULL
272
+ );
273
+
274
+ CREATE INDEX IF NOT EXISTS idx_tribunal_mission_id ON tribunal_state(mission_id);
275
+ CREATE INDEX IF NOT EXISTS idx_tribunal_status ON tribunal_state(status);
276
+
260
277
  -- ── Metadata / caches ────────────────────────────────────────
261
278
 
262
279
  CREATE TABLE IF NOT EXISTS index_metadata (
@@ -0,0 +1,24 @@
1
+ -- Tribunal daemon session state for asynchronous mission peer-review runs.
2
+ -- Session UUID is the primary key; pid is advisory-only for debugging.
3
+
4
+ CREATE TABLE IF NOT EXISTS tribunal_state (
5
+ session_id TEXT PRIMARY KEY,
6
+ mission_id INTEGER,
7
+ repo_path TEXT NOT NULL,
8
+ status TEXT DEFAULT 'running',
9
+ phase TEXT DEFAULT 'initializing',
10
+ pid INTEGER,
11
+ artifact_id INTEGER,
12
+ started_at REAL DEFAULT (unixepoch()),
13
+ completed_at REAL,
14
+ FOREIGN KEY(mission_id) REFERENCES missions(id) ON DELETE SET NULL,
15
+ FOREIGN KEY(artifact_id) REFERENCES mission_artifacts(id) ON DELETE SET NULL
16
+ );
17
+
18
+ CREATE INDEX IF NOT EXISTS idx_tribunal_mission_id ON tribunal_state(mission_id);
19
+ CREATE INDEX IF NOT EXISTS idx_tribunal_status ON tribunal_state(status);
20
+
21
+ -- DOWN
22
+ DROP INDEX IF EXISTS idx_tribunal_status;
23
+ DROP INDEX IF EXISTS idx_tribunal_mission_id;
24
+ DROP TABLE IF EXISTS tribunal_state;
@@ -0,0 +1,52 @@
1
+ PRAGMA foreign_keys = OFF;
2
+
3
+ ALTER TABLE mission_artifacts RENAME TO mission_artifacts_old;
4
+
5
+ CREATE TABLE IF NOT EXISTS mission_artifacts (
6
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
7
+ mission_id INTEGER,
8
+ type TEXT NOT NULL,
9
+ identifier TEXT NOT NULL,
10
+ metadata TEXT,
11
+ embedding TEXT DEFAULT NULL,
12
+ created_at INTEGER DEFAULT (unixepoch()),
13
+ FOREIGN KEY(mission_id) REFERENCES missions(id) ON DELETE CASCADE
14
+ );
15
+
16
+ INSERT INTO mission_artifacts (id, mission_id, type, identifier, metadata, embedding, created_at)
17
+ SELECT id, NULLIF(mission_id, 0), type, identifier, metadata, embedding, created_at
18
+ FROM mission_artifacts_old;
19
+
20
+ DROP TABLE mission_artifacts_old;
21
+
22
+ CREATE INDEX IF NOT EXISTS idx_mission_artifacts_mission ON mission_artifacts(mission_id);
23
+ CREATE INDEX IF NOT EXISTS idx_mission_artifacts_embedding ON mission_artifacts(id) WHERE embedding IS NOT NULL;
24
+
25
+ PRAGMA foreign_keys = ON;
26
+
27
+ -- DOWN
28
+ PRAGMA foreign_keys = OFF;
29
+
30
+ ALTER TABLE mission_artifacts RENAME TO mission_artifacts_new;
31
+
32
+ CREATE TABLE IF NOT EXISTS mission_artifacts (
33
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
34
+ mission_id INTEGER NOT NULL,
35
+ type TEXT NOT NULL,
36
+ identifier TEXT NOT NULL,
37
+ metadata TEXT,
38
+ embedding TEXT DEFAULT NULL,
39
+ created_at INTEGER DEFAULT (unixepoch()),
40
+ FOREIGN KEY(mission_id) REFERENCES missions(id) ON DELETE CASCADE
41
+ );
42
+
43
+ INSERT INTO mission_artifacts (id, mission_id, type, identifier, metadata, embedding, created_at)
44
+ SELECT id, COALESCE(mission_id, 0), type, identifier, metadata, embedding, created_at
45
+ FROM mission_artifacts_new;
46
+
47
+ DROP TABLE mission_artifacts_new;
48
+
49
+ CREATE INDEX IF NOT EXISTS idx_mission_artifacts_mission ON mission_artifacts(mission_id);
50
+ CREATE INDEX IF NOT EXISTS idx_mission_artifacts_embedding ON mission_artifacts(id) WHERE embedding IS NOT NULL;
51
+
52
+ PRAGMA foreign_keys = ON;
@@ -0,0 +1,58 @@
1
+ PRAGMA foreign_keys = OFF;
2
+
3
+ ALTER TABLE tribunal_state RENAME TO tribunal_state_old;
4
+
5
+ CREATE TABLE IF NOT EXISTS tribunal_state (
6
+ session_id TEXT PRIMARY KEY,
7
+ mission_id INTEGER,
8
+ repo_path TEXT NOT NULL,
9
+ status TEXT DEFAULT 'running',
10
+ phase TEXT DEFAULT 'initializing',
11
+ pid INTEGER,
12
+ artifact_id INTEGER,
13
+ started_at REAL DEFAULT (unixepoch()),
14
+ completed_at REAL,
15
+ FOREIGN KEY(mission_id) REFERENCES missions(id) ON DELETE SET NULL,
16
+ FOREIGN KEY(artifact_id) REFERENCES mission_artifacts(id) ON DELETE SET NULL
17
+ );
18
+
19
+ INSERT INTO tribunal_state (session_id, mission_id, repo_path, status, phase, pid, artifact_id, started_at, completed_at)
20
+ SELECT session_id, mission_id, repo_path, status, phase, pid, artifact_id, started_at, completed_at
21
+ FROM tribunal_state_old;
22
+
23
+ DROP TABLE tribunal_state_old;
24
+
25
+ CREATE INDEX IF NOT EXISTS idx_tribunal_mission_id ON tribunal_state(mission_id);
26
+ CREATE INDEX IF NOT EXISTS idx_tribunal_status ON tribunal_state(status);
27
+
28
+ PRAGMA foreign_keys = ON;
29
+
30
+ -- DOWN
31
+ PRAGMA foreign_keys = OFF;
32
+
33
+ ALTER TABLE tribunal_state RENAME TO tribunal_state_new;
34
+
35
+ CREATE TABLE IF NOT EXISTS tribunal_state (
36
+ session_id TEXT PRIMARY KEY,
37
+ mission_id INTEGER,
38
+ repo_path TEXT NOT NULL,
39
+ status TEXT DEFAULT 'running',
40
+ phase TEXT DEFAULT 'initializing',
41
+ pid INTEGER,
42
+ artifact_id INTEGER,
43
+ started_at REAL DEFAULT (unixepoch()),
44
+ completed_at REAL,
45
+ FOREIGN KEY(mission_id) REFERENCES missions(id) ON DELETE SET NULL,
46
+ FOREIGN KEY(artifact_id) REFERENCES mission_artifacts_old(id) ON DELETE SET NULL
47
+ );
48
+
49
+ INSERT INTO tribunal_state (session_id, mission_id, repo_path, status, phase, pid, artifact_id, started_at, completed_at)
50
+ SELECT session_id, mission_id, repo_path, status, phase, pid, artifact_id, started_at, completed_at
51
+ FROM tribunal_state_new;
52
+
53
+ DROP TABLE tribunal_state_new;
54
+
55
+ CREATE INDEX IF NOT EXISTS idx_tribunal_mission_id ON tribunal_state(mission_id);
56
+ CREATE INDEX IF NOT EXISTS idx_tribunal_status ON tribunal_state(status);
57
+
58
+ PRAGMA foreign_keys = ON;