@precisionutilityguild/liquid-shadow 1.0.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/LICENSE +184 -0
- package/README.md +194 -0
- package/dist/data/migrations/001_initial_schema.sql +79 -0
- package/dist/data/migrations/002_fts_indexes.sql +94 -0
- package/dist/data/migrations/003_mission_system.sql +86 -0
- package/dist/data/migrations/004_event_mesh.sql +17 -0
- package/dist/data/migrations/005_index_metadata.sql +15 -0
- package/dist/data/migrations/006_search_history.sql +17 -0
- package/dist/data/migrations/007_hologram_snapshot.sql +14 -0
- package/dist/entry/cli/index.js +822 -0
- package/dist/entry/mcp/server.js +894 -0
- package/dist/index.js +453 -0
- package/dist/logic/domain/embeddings/worker.js +1 -0
- package/package.json +100 -0
- package/skills/audit/SKILL.md +29 -0
- package/skills/chronicle/SKILL.md +33 -0
- package/skills/continue/SKILL.md +44 -0
- package/skills/mission/SKILL.md +35 -0
- package/skills/onboard/SKILL.md +27 -0
- package/skills/understand/SKILL.md +35 -0
- package/skills/workspace/SKILL.md +25 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work of authorship, whether in
|
|
41
|
+
Source or Object form, that is based on (or derived from) the Work
|
|
42
|
+
and for which the editorial revisions, annotations, elaborations,
|
|
43
|
+
or other modifications represent, as a whole, an original work of
|
|
44
|
+
authorship. For the purposes of this License, Derivative Works shall
|
|
45
|
+
not include works that remain separable from, or merely link (or
|
|
46
|
+
bind by name) to the interfaces of, the Work and Derivative Works
|
|
47
|
+
thereof.
|
|
48
|
+
|
|
49
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
50
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
51
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
52
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
53
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
54
|
+
Work and such Derivative Works in Source or Object form.
|
|
55
|
+
|
|
56
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
57
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
58
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
59
|
+
(except as stated in this section) patent license to make, have made,
|
|
60
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
61
|
+
where such license applies only to those patent claims licensable
|
|
62
|
+
by such Contributor that are necessarily infringed by their
|
|
63
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
64
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
65
|
+
institute patent litigation against any entity (including a
|
|
66
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
67
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
68
|
+
or contributory patent infringement, then any patent licenses
|
|
69
|
+
granted to You under this License for that Work shall terminate
|
|
70
|
+
as of the date such litigation is filed.
|
|
71
|
+
|
|
72
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
73
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
74
|
+
modifications, and in Source or Object form, provided that You
|
|
75
|
+
meet the following conditions:
|
|
76
|
+
|
|
77
|
+
(a) You must give any other recipients of the Work or
|
|
78
|
+
Derivative Works a copy of this License; and
|
|
79
|
+
|
|
80
|
+
(b) You must cause any modified files to carry prominent notices
|
|
81
|
+
stating that You changed the files; and
|
|
82
|
+
|
|
83
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
84
|
+
that You distribute, all copyright, patent, trademark, and
|
|
85
|
+
attribution notices from the Source form of the Work,
|
|
86
|
+
excluding those notices that do not pertain to any part of
|
|
87
|
+
the Derivative Works; and
|
|
88
|
+
|
|
89
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
90
|
+
distribution, then any Derivative Works that You distribute must
|
|
91
|
+
include a readable copy of the attribution notices contained
|
|
92
|
+
within such NOTICE file, excluding those notices that do not
|
|
93
|
+
pertain to any part of the Derivative Works, in at least one
|
|
94
|
+
of the following places: within a NOTICE text file distributed
|
|
95
|
+
as part of the Derivative Works; within the Source form or
|
|
96
|
+
documentation, if provided along with the Derivative Works; or,
|
|
97
|
+
within a display generated by the Derivative Works, if and
|
|
98
|
+
wherever such third-party notices normally appear. The contents
|
|
99
|
+
of the NOTICE file are for informational purposes only and
|
|
100
|
+
do not modify the License. You may add Your own attribution
|
|
101
|
+
notices within Derivative Works that You distribute, alongside
|
|
102
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
103
|
+
that such additional attribution notices cannot be construed
|
|
104
|
+
as modifying the License.
|
|
105
|
+
|
|
106
|
+
You may add Your own copyright statement to Your modifications and
|
|
107
|
+
may provide additional or different license terms and conditions
|
|
108
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
109
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
110
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
111
|
+
the conditions stated in this License.
|
|
112
|
+
|
|
113
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
114
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
115
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
116
|
+
this License, without any additional terms or conditions.
|
|
117
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
118
|
+
the terms of any separate license agreement you may have executed
|
|
119
|
+
with Licensor regarding such Contributions.
|
|
120
|
+
|
|
121
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
122
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
123
|
+
except as required for reasonable and customary use in describing the
|
|
124
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
125
|
+
|
|
126
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
127
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
128
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
129
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
130
|
+
implied, including, without limitation, any warranties or conditions
|
|
131
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
132
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
133
|
+
appropriateness of using or redistributing the Work and assume any
|
|
134
|
+
risks associated with Your exercise of permissions under this License.
|
|
135
|
+
|
|
136
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
137
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
138
|
+
unless required by applicable law (such as deliberate and grossly
|
|
139
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
140
|
+
liable to You for damages, including any direct, indirect, special,
|
|
141
|
+
incidental, or consequential damages of any character arising as a
|
|
142
|
+
result of this License or out of the use or inability to use the
|
|
143
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
144
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
145
|
+
other commercial damages or losses), even if such Contributor
|
|
146
|
+
has been advised of the possibility of such damages.
|
|
147
|
+
|
|
148
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
149
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
150
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
151
|
+
or other liability obligations and/or rights consistent with this
|
|
152
|
+
License. However, in accepting such obligations, You may act only
|
|
153
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
154
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
155
|
+
defend, and hold each Contributor harmless for any liability
|
|
156
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
157
|
+
of your accepting any such warranty or additional liability.
|
|
158
|
+
|
|
159
|
+
END OF TERMS AND CONDITIONS
|
|
160
|
+
|
|
161
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
162
|
+
|
|
163
|
+
To apply the Apache License to your work, attach the following
|
|
164
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
165
|
+
replaced with your own identifying information. (Don't include
|
|
166
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
167
|
+
comment syntax for the file format. We also recommend that a
|
|
168
|
+
file or class name and description of purpose be included on the
|
|
169
|
+
same "printed page" as the copyright notice for easier
|
|
170
|
+
identification within third-party archives.
|
|
171
|
+
|
|
172
|
+
Copyright 2026 Precision Utility Guild
|
|
173
|
+
|
|
174
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
175
|
+
you may not use this file except in compliance with the License.
|
|
176
|
+
You may obtain a copy of the License at
|
|
177
|
+
|
|
178
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
179
|
+
|
|
180
|
+
Unless required by applicable law or agreed to in writing, software
|
|
181
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
182
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
183
|
+
See the License for the specific language governing permissions and
|
|
184
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
# 🌑 Liquid Shadow
|
|
2
|
+
|
|
3
|
+
[](https://github.com/PrecisionUtilityGuild/liquid-shadow)
|
|
4
|
+
[]()
|
|
5
|
+
[]()
|
|
6
|
+
|
|
7
|
+
**Tactical Repository Intelligence Operative - The AI-First Intelligence Layer.**
|
|
8
|
+
|
|
9
|
+
Liquid Shadow transforms any codebase into a high-signal knowledge graph. It is built **exclusively for AI Agents** to navigate, reason about, and modify large-scale polyglot repositories with precision and token efficiency.
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## MCP-First Quick Start
|
|
14
|
+
|
|
15
|
+
Liquid Shadow is primarily an **MCP (Model Context Protocol) Server**. It is the bridge between your reasoning engine and the raw filesystem.
|
|
16
|
+
|
|
17
|
+
### 1. Consumption Model
|
|
18
|
+
|
|
19
|
+
Since Liquid Shadow is a tactical tool, we recommend consuming it via **npx** to ensure you always have the latest intelligence layer:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
# General use (CLI)
|
|
23
|
+
npx @precisionutilityguild/liquid-shadow [command]
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### 2. Connect to your Agent
|
|
27
|
+
|
|
28
|
+
Add the following to your MCP configuration (e.g., `claude_desktop_config.json`):
|
|
29
|
+
|
|
30
|
+
```json
|
|
31
|
+
{
|
|
32
|
+
"mcpServers": {
|
|
33
|
+
"liquid-shadow": {
|
|
34
|
+
"command": "npx",
|
|
35
|
+
"args": ["-y", "@precisionutilityguild/liquid-shadow", "liquid-shadow-mcp"]
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### 3. Tactical Onboarding (The Mission Loop)
|
|
42
|
+
|
|
43
|
+
Once connected, your agent should follow the **Intelligence Lifecycle**:
|
|
44
|
+
|
|
45
|
+
```typescript
|
|
46
|
+
// 🛡️ RECON: Initialize the intelligence index
|
|
47
|
+
shadow_recon_onboard({ repoPath: '.' });
|
|
48
|
+
shadow_sync_trace({ repoPath: '.' });
|
|
49
|
+
|
|
50
|
+
// 📦 SESSION CONTEXT (one call): hologram + chronicle(5) + briefing
|
|
51
|
+
shadow_ops_context({ repoPath: '.' });
|
|
52
|
+
|
|
53
|
+
// PLAN: Establish the tactical mission
|
|
54
|
+
shadow_ops_plan({
|
|
55
|
+
repoPath: '.',
|
|
56
|
+
name: 'Auth Refactor',
|
|
57
|
+
goal: 'Migrate JWT logic to Session-based auth',
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
// ANALYZE: Trace the execution flow
|
|
61
|
+
shadow_analyze_flow({
|
|
62
|
+
repoPath: '.',
|
|
63
|
+
filePath: 'src/auth/handler.ts',
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
// LOG: Save architectural decisions (SIGINT)
|
|
67
|
+
shadow_ops_log({
|
|
68
|
+
missionId: 1,
|
|
69
|
+
repoPath: '.',
|
|
70
|
+
type: 'decision',
|
|
71
|
+
content: 'Selected Redis for session storage due to latency requirements',
|
|
72
|
+
});
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
## Core Tactical Suite
|
|
78
|
+
|
|
79
|
+
Liquid Shadow is powered by **31 Atomic Tools**, organized into specialized intelligence suites:
|
|
80
|
+
|
|
81
|
+
| Suite | Atomic Tools (MCP) | Tactical Purpose |
|
|
82
|
+
| :--------------- | :------------------------------------------------------------------------------------------------------------- | :--------------------------------------------------------------------------------------------------------------- |
|
|
83
|
+
| **Ops Control** | `shadow_ops_plan`, `_track`, `_briefing`, `_context`, `_log`, `_synthesize`, `_chronicle`, `_health`, `_graph` | Mission management, ADR synthesis; **`_context`** = session start (hologram + chronicle + briefing in one call). |
|
|
84
|
+
| **Intelligence** | `shadow_analyze_impact`, `_flow`, `_deps`, `_debt` | Deep architectural reasoning and dependency tracing. |
|
|
85
|
+
| **Discovery** | `shadow_search_concept`, `_symbol`, `_config`, `_path` | Semantic and lexical search across the entire graph. |
|
|
86
|
+
| **Recon** | `shadow_recon_onboard`, `_tree`, `_hologram`, `_topography`, `_scout` | Structural analysis and layer classification. |
|
|
87
|
+
| **Inspection** | `shadow_inspect_symbol`, `_file` | Dense code retrieval with semantic folding. |
|
|
88
|
+
| **Maintenance** | `shadow_sync_trace`, `_index`, `_repair` | Intelligence synchronization and Nano-Repair. |
|
|
89
|
+
| **Workspace** | `shadow_workspace_list`, `_link`, `_fuse` | Multi-repository mission linking and index fusion. |
|
|
90
|
+
| **Environment** | `shadow_env_hooks`, `_diagnose` | Git hook automation and system health diagnostics. |
|
|
91
|
+
|
|
92
|
+
### 🎯 `shadow_inspect_*` Quick Reference
|
|
93
|
+
|
|
94
|
+
| I want to... | Mode | Parameter | Value |
|
|
95
|
+
| -------------------------------------------------- | -------- | ------------- | ------------------------ |
|
|
96
|
+
| See**ALL exports** from a file | `file` | `detailLevel` | `"signatures"` (default) |
|
|
97
|
+
| See**ONE specific symbol** (truncated) | `symbol` | `context` | `"definition"` (default) |
|
|
98
|
+
| See**ONE specific symbol** + dependencies + usages | `symbol` | `context` | `"full"` |
|
|
99
|
+
| Just export names (minimal tokens) | `file` | `detailLevel` | `"structure"` |
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
## Performance
|
|
104
|
+
|
|
105
|
+
Liquid Shadow is optimized for ultra-fast indexing and semantic retrieval. Performance is benchmarked against enterprise-grade repositories.
|
|
106
|
+
|
|
107
|
+
### Enterprise Benchmark (Custom Repo)
|
|
108
|
+
|
|
109
|
+
- **Total Files**: 4,306 files (TS + PHP + PY)
|
|
110
|
+
- **Symbols Extracted**: 22,185 symbols (with deep closure indexing)
|
|
111
|
+
- **Index Time**: 17.8s (Fresh start)
|
|
112
|
+
- **Throughput**: ~242 files/sec
|
|
113
|
+
- **Symbols/sec**: ~1,247 symbols/sec
|
|
114
|
+
- **Note**: Deep closure indexing extracts 30% more symbols (nested functions, closures) compared to top-level-only extraction
|
|
115
|
+
|
|
116
|
+
### Large-Scale Benchmark (VS Code Core)
|
|
117
|
+
|
|
118
|
+
- **Total Files**: 6,196 files
|
|
119
|
+
- **Symbols Extracted**: 109,997 symbols (with deep closure indexing)
|
|
120
|
+
- **Index Time**: 116.6s (Fresh start)
|
|
121
|
+
- **Throughput**: ~53 files/sec
|
|
122
|
+
- **Symbols/sec**: ~943 symbols/sec
|
|
123
|
+
- **Scalability**: Verified 100k+ symbol graph support
|
|
124
|
+
|
|
125
|
+
### High-Volume Benchmark (Next.js)
|
|
126
|
+
|
|
127
|
+
- **Total Files**: 9,785 files
|
|
128
|
+
- **Symbols Extracted**: 20,701 symbols (with deep closure indexing)
|
|
129
|
+
- **Index Time**: 24.2s (Fresh start)
|
|
130
|
+
- **Throughput**: ~404 files/sec
|
|
131
|
+
- **Symbols/sec**: ~855 symbols/sec
|
|
132
|
+
|
|
133
|
+
### Running Benchmarks
|
|
134
|
+
|
|
135
|
+
To benchmark performance on your own repository:
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
npx @precisionutilityguild/liquid-shadow benchmark -- /path/to/repo
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
---
|
|
142
|
+
|
|
143
|
+
## Configuration
|
|
144
|
+
|
|
145
|
+
### Indexing Concurrency
|
|
146
|
+
|
|
147
|
+
Liquid Shadow allows you to tune indexing concurrency based on your system resources. Higher concurrency speeds up indexing but increases memory usage.
|
|
148
|
+
|
|
149
|
+
**Environment Variable** (Global):
|
|
150
|
+
|
|
151
|
+
```bash
|
|
152
|
+
export INDEX_CONCURRENCY=10 # Default: 5
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
**Repository Config** (Per-Repo):
|
|
156
|
+
Add to `.liquid-shadow.yaml`:
|
|
157
|
+
|
|
158
|
+
```yaml
|
|
159
|
+
concurrency: 10 # Overrides INDEX_CONCURRENCY for this repo
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
**Recommendations**:
|
|
163
|
+
|
|
164
|
+
- **Low-memory systems**: 3-5 (default)
|
|
165
|
+
- **Standard systems**: 5-10
|
|
166
|
+
- **High-memory systems**: 10-20
|
|
167
|
+
- **Very large repos**: Monitor memory usage and adjust accordingly
|
|
168
|
+
|
|
169
|
+
The concurrency setting controls how many files are processed in parallel during indexing. File parsing is I/O bound, so higher concurrency is beneficial on systems with sufficient RAM.
|
|
170
|
+
|
|
171
|
+
---
|
|
172
|
+
|
|
173
|
+
## Documentation
|
|
174
|
+
|
|
175
|
+
Explore the deeper tactical layers of Liquid Shadow:
|
|
176
|
+
|
|
177
|
+
- [**Shadow Quick Reference**](./docs/SHADOW_QUICK_REFERENCE.md): **Start here.** Decision flow (“I want to… → use this”), one-liner per tool, and workflow recipes (new chat, understand file, refactor safely, run a mission, multi-repo).
|
|
178
|
+
- [**Skills**](./skills/): Workflow-specific guidance — `understand`, `onboard`, `mission`, `continue`, `chronicle`, `workspace`, `audit`.
|
|
179
|
+
- [**Examples**](./examples/): `mission-tracking`, `onboarding-workflow`, `refactoring-analysis` — concrete flows with Shadow tools.
|
|
180
|
+
|
|
181
|
+
---
|
|
182
|
+
|
|
183
|
+
## Key Differentiators
|
|
184
|
+
|
|
185
|
+
- **Liquid Anchor**: Intelligence that survives refactors and file moves via `shadow_sync_repair`.
|
|
186
|
+
- **Semantic Sieve**: High-signal, token-efficient summaries designed to maximize your context window.
|
|
187
|
+
- **Polyglot Unity**: Unified symbol graph across TypeScript, PHP, Python, Go, and more.
|
|
188
|
+
- **Situational Awareness**: Persistent state via missions and intent logs, allowing for seamless context transitions.
|
|
189
|
+
- **Session-Start Bundle**: `shadow_ops_context` returns hologram + chronicle (last 5) + briefing in one call—ideal for "new chat, give me the world."
|
|
190
|
+
|
|
191
|
+
---
|
|
192
|
+
|
|
193
|
+
_Powered by SQLite FTS5, SWC, and Precision Intelligence._
|
|
194
|
+
_Crafted by Precision Utility Guild._
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
-- Initial database schema with core tables and indexes
|
|
2
|
+
|
|
3
|
+
CREATE TABLE IF NOT EXISTS files (
|
|
4
|
+
path TEXT PRIMARY KEY,
|
|
5
|
+
mtime REAL,
|
|
6
|
+
last_scanned_at REAL,
|
|
7
|
+
classification TEXT,
|
|
8
|
+
summary TEXT,
|
|
9
|
+
embedding TEXT,
|
|
10
|
+
content_hash TEXT
|
|
11
|
+
);
|
|
12
|
+
|
|
13
|
+
CREATE TABLE IF NOT EXISTS exports (
|
|
14
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
15
|
+
file_path TEXT,
|
|
16
|
+
name TEXT,
|
|
17
|
+
kind TEXT,
|
|
18
|
+
signature TEXT,
|
|
19
|
+
doc TEXT,
|
|
20
|
+
start_line INTEGER,
|
|
21
|
+
end_line INTEGER,
|
|
22
|
+
classification TEXT,
|
|
23
|
+
capabilities TEXT,
|
|
24
|
+
parent_id INTEGER,
|
|
25
|
+
embedding TEXT,
|
|
26
|
+
FOREIGN KEY(file_path) REFERENCES files(path) ON DELETE CASCADE,
|
|
27
|
+
FOREIGN KEY(parent_id) REFERENCES exports(id) ON DELETE CASCADE
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
CREATE TABLE IF NOT EXISTS imports (
|
|
31
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
32
|
+
file_path TEXT,
|
|
33
|
+
module_specifier TEXT,
|
|
34
|
+
imported_symbols TEXT,
|
|
35
|
+
resolved_path TEXT,
|
|
36
|
+
FOREIGN KEY(file_path) REFERENCES files(path) ON DELETE CASCADE
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
CREATE TABLE IF NOT EXISTS configs (
|
|
40
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
41
|
+
file_path TEXT,
|
|
42
|
+
key TEXT,
|
|
43
|
+
value TEXT,
|
|
44
|
+
kind TEXT,
|
|
45
|
+
FOREIGN KEY(file_path) REFERENCES files(path) ON DELETE CASCADE
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
CREATE TABLE IF NOT EXISTS file_content (
|
|
49
|
+
file_path TEXT PRIMARY KEY,
|
|
50
|
+
content TEXT,
|
|
51
|
+
FOREIGN KEY(file_path) REFERENCES files(path) ON DELETE CASCADE
|
|
52
|
+
);
|
|
53
|
+
|
|
54
|
+
-- Indexes
|
|
55
|
+
CREATE INDEX IF NOT EXISTS idx_exports_file_path ON exports(file_path);
|
|
56
|
+
CREATE INDEX IF NOT EXISTS idx_exports_name ON exports(name);
|
|
57
|
+
CREATE INDEX IF NOT EXISTS idx_exports_parent_id ON exports(parent_id);
|
|
58
|
+
CREATE INDEX IF NOT EXISTS idx_exports_classification ON exports(classification);
|
|
59
|
+
CREATE INDEX IF NOT EXISTS idx_imports_file_path ON imports(file_path);
|
|
60
|
+
CREATE INDEX IF NOT EXISTS idx_imports_resolved_path ON imports(resolved_path);
|
|
61
|
+
CREATE INDEX IF NOT EXISTS idx_configs_file_path ON configs(file_path);
|
|
62
|
+
CREATE INDEX IF NOT EXISTS idx_configs_kind ON configs(kind);
|
|
63
|
+
CREATE INDEX IF NOT EXISTS idx_files_classification ON files(classification);
|
|
64
|
+
|
|
65
|
+
-- DOWN
|
|
66
|
+
DROP INDEX IF EXISTS idx_files_classification;
|
|
67
|
+
DROP INDEX IF EXISTS idx_configs_kind;
|
|
68
|
+
DROP INDEX IF EXISTS idx_configs_file_path;
|
|
69
|
+
DROP INDEX IF EXISTS idx_imports_resolved_path;
|
|
70
|
+
DROP INDEX IF EXISTS idx_imports_file_path;
|
|
71
|
+
DROP INDEX IF EXISTS idx_exports_classification;
|
|
72
|
+
DROP INDEX IF EXISTS idx_exports_parent_id;
|
|
73
|
+
DROP INDEX IF EXISTS idx_exports_name;
|
|
74
|
+
DROP INDEX IF EXISTS idx_exports_file_path;
|
|
75
|
+
DROP TABLE IF EXISTS file_content;
|
|
76
|
+
DROP TABLE IF EXISTS configs;
|
|
77
|
+
DROP TABLE IF EXISTS imports;
|
|
78
|
+
DROP TABLE IF EXISTS exports;
|
|
79
|
+
DROP TABLE IF EXISTS files;
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
-- Full-text search (FTS5) tables and triggers
|
|
2
|
+
|
|
3
|
+
-- FTS5 for exports (symbol search)
|
|
4
|
+
CREATE VIRTUAL TABLE IF NOT EXISTS exports_fts USING fts5(
|
|
5
|
+
name,
|
|
6
|
+
signature,
|
|
7
|
+
doc,
|
|
8
|
+
content='exports',
|
|
9
|
+
content_rowid='id'
|
|
10
|
+
);
|
|
11
|
+
|
|
12
|
+
-- FTS5 for file summaries (semantic intent search)
|
|
13
|
+
CREATE VIRTUAL TABLE IF NOT EXISTS files_fts USING fts5(
|
|
14
|
+
path,
|
|
15
|
+
summary,
|
|
16
|
+
content='files',
|
|
17
|
+
content_rowid='rowid'
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
-- FTS5 for full file content (Smart Grep)
|
|
21
|
+
CREATE VIRTUAL TABLE IF NOT EXISTS content_fts USING fts5(
|
|
22
|
+
file_path,
|
|
23
|
+
content,
|
|
24
|
+
content='file_content',
|
|
25
|
+
content_rowid='rowid'
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
-- Triggers to keep exports_fts in sync
|
|
29
|
+
CREATE TRIGGER IF NOT EXISTS exports_ai AFTER INSERT ON exports BEGIN
|
|
30
|
+
INSERT INTO exports_fts(rowid, name, signature, doc)
|
|
31
|
+
VALUES (new.id, new.name, new.signature, new.doc);
|
|
32
|
+
END;
|
|
33
|
+
|
|
34
|
+
CREATE TRIGGER IF NOT EXISTS exports_ad AFTER DELETE ON exports BEGIN
|
|
35
|
+
INSERT INTO exports_fts(exports_fts, rowid, name, signature, doc)
|
|
36
|
+
VALUES('delete', old.id, old.name, old.signature, old.doc);
|
|
37
|
+
END;
|
|
38
|
+
|
|
39
|
+
CREATE TRIGGER IF NOT EXISTS exports_au AFTER UPDATE ON exports BEGIN
|
|
40
|
+
INSERT INTO exports_fts(exports_fts, rowid, name, signature, doc)
|
|
41
|
+
VALUES('delete', old.id, old.name, old.signature, old.doc);
|
|
42
|
+
INSERT INTO exports_fts(rowid, name, signature, doc)
|
|
43
|
+
VALUES (new.id, new.name, new.signature, new.doc);
|
|
44
|
+
END;
|
|
45
|
+
|
|
46
|
+
-- Triggers to keep files_fts in sync
|
|
47
|
+
CREATE TRIGGER IF NOT EXISTS files_ai AFTER INSERT ON files BEGIN
|
|
48
|
+
INSERT INTO files_fts(rowid, path, summary)
|
|
49
|
+
VALUES (new.rowid, new.path, new.summary);
|
|
50
|
+
END;
|
|
51
|
+
|
|
52
|
+
CREATE TRIGGER IF NOT EXISTS files_ad AFTER DELETE ON files BEGIN
|
|
53
|
+
INSERT INTO files_fts(files_fts, rowid, path, summary)
|
|
54
|
+
VALUES('delete', old.rowid, old.path, old.summary);
|
|
55
|
+
END;
|
|
56
|
+
|
|
57
|
+
CREATE TRIGGER IF NOT EXISTS files_au AFTER UPDATE ON files BEGIN
|
|
58
|
+
INSERT INTO files_fts(files_fts, rowid, path, summary)
|
|
59
|
+
VALUES('delete', old.rowid, old.path, old.summary);
|
|
60
|
+
INSERT INTO files_fts(rowid, path, summary)
|
|
61
|
+
VALUES (new.rowid, new.path, new.summary);
|
|
62
|
+
END;
|
|
63
|
+
|
|
64
|
+
-- Triggers to keep content_fts in sync
|
|
65
|
+
CREATE TRIGGER IF NOT EXISTS content_ai AFTER INSERT ON file_content BEGIN
|
|
66
|
+
INSERT INTO content_fts(rowid, file_path, content)
|
|
67
|
+
VALUES (new.rowid, new.file_path, new.content);
|
|
68
|
+
END;
|
|
69
|
+
|
|
70
|
+
CREATE TRIGGER IF NOT EXISTS content_ad AFTER DELETE ON file_content BEGIN
|
|
71
|
+
INSERT INTO content_fts(content_fts, rowid, file_path, content)
|
|
72
|
+
VALUES('delete', old.rowid, old.file_path, old.content);
|
|
73
|
+
END;
|
|
74
|
+
|
|
75
|
+
CREATE TRIGGER IF NOT EXISTS content_au AFTER UPDATE ON file_content BEGIN
|
|
76
|
+
INSERT INTO content_fts(content_fts, rowid, file_path, content)
|
|
77
|
+
VALUES('delete', old.rowid, old.file_path, old.content);
|
|
78
|
+
INSERT INTO content_fts(rowid, file_path, content)
|
|
79
|
+
VALUES (new.rowid, new.file_path, new.content);
|
|
80
|
+
END;
|
|
81
|
+
|
|
82
|
+
-- DOWN
|
|
83
|
+
DROP TRIGGER IF EXISTS content_au;
|
|
84
|
+
DROP TRIGGER IF EXISTS content_ad;
|
|
85
|
+
DROP TRIGGER IF EXISTS content_ai;
|
|
86
|
+
DROP TRIGGER IF EXISTS files_au;
|
|
87
|
+
DROP TRIGGER IF EXISTS files_ad;
|
|
88
|
+
DROP TRIGGER IF EXISTS files_ai;
|
|
89
|
+
DROP TRIGGER IF EXISTS exports_au;
|
|
90
|
+
DROP TRIGGER IF EXISTS exports_ad;
|
|
91
|
+
DROP TRIGGER IF EXISTS exports_ai;
|
|
92
|
+
DROP TABLE IF EXISTS content_fts;
|
|
93
|
+
DROP TABLE IF EXISTS files_fts;
|
|
94
|
+
DROP TABLE IF EXISTS exports_fts;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
-- Mission tracking system (Cognitive Overlay)
|
|
2
|
+
|
|
3
|
+
CREATE TABLE IF NOT EXISTS missions (
|
|
4
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
5
|
+
name TEXT NOT NULL,
|
|
6
|
+
goal TEXT,
|
|
7
|
+
status TEXT DEFAULT 'planned',
|
|
8
|
+
strategy_graph TEXT,
|
|
9
|
+
git_branch TEXT,
|
|
10
|
+
commit_sha TEXT,
|
|
11
|
+
parent_id INTEGER,
|
|
12
|
+
verification_context TEXT,
|
|
13
|
+
outcome_contract TEXT,
|
|
14
|
+
created_at REAL DEFAULT (unixepoch()),
|
|
15
|
+
updated_at REAL DEFAULT (unixepoch()),
|
|
16
|
+
FOREIGN KEY(parent_id) REFERENCES missions(id) ON DELETE CASCADE
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
CREATE TABLE IF NOT EXISTS mission_artifacts (
|
|
20
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
21
|
+
mission_id INTEGER NOT NULL,
|
|
22
|
+
type TEXT NOT NULL,
|
|
23
|
+
identifier TEXT NOT NULL,
|
|
24
|
+
metadata TEXT,
|
|
25
|
+
created_at INTEGER DEFAULT (unixepoch()),
|
|
26
|
+
FOREIGN KEY(mission_id) REFERENCES missions(id) ON DELETE CASCADE
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
CREATE TABLE IF NOT EXISTS intent_logs (
|
|
30
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
31
|
+
mission_id INTEGER,
|
|
32
|
+
symbol_id INTEGER,
|
|
33
|
+
file_path TEXT,
|
|
34
|
+
type TEXT,
|
|
35
|
+
content TEXT,
|
|
36
|
+
confidence REAL DEFAULT 1.0,
|
|
37
|
+
symbol_name TEXT,
|
|
38
|
+
signature TEXT,
|
|
39
|
+
commit_sha TEXT,
|
|
40
|
+
created_at REAL DEFAULT (unixepoch()),
|
|
41
|
+
FOREIGN KEY(mission_id) REFERENCES missions(id) ON DELETE CASCADE,
|
|
42
|
+
FOREIGN KEY(symbol_id) REFERENCES exports(id) ON DELETE SET NULL,
|
|
43
|
+
FOREIGN KEY(file_path) REFERENCES files(path) ON DELETE CASCADE
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
CREATE TABLE IF NOT EXISTS working_set (
|
|
47
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
48
|
+
mission_id INTEGER,
|
|
49
|
+
file_path TEXT,
|
|
50
|
+
symbol_id INTEGER,
|
|
51
|
+
type TEXT,
|
|
52
|
+
created_at REAL DEFAULT (unixepoch()),
|
|
53
|
+
FOREIGN KEY(mission_id) REFERENCES missions(id) ON DELETE CASCADE,
|
|
54
|
+
FOREIGN KEY(file_path) REFERENCES files(path) ON DELETE CASCADE,
|
|
55
|
+
FOREIGN KEY(symbol_id) REFERENCES exports(id) ON DELETE CASCADE
|
|
56
|
+
);
|
|
57
|
+
|
|
58
|
+
CREATE TABLE IF NOT EXISTS cross_repo_links (
|
|
59
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
60
|
+
mission_id INTEGER NOT NULL,
|
|
61
|
+
linked_repo_path TEXT NOT NULL,
|
|
62
|
+
linked_mission_id INTEGER NOT NULL,
|
|
63
|
+
relationship TEXT,
|
|
64
|
+
direction TEXT,
|
|
65
|
+
created_at REAL DEFAULT (unixepoch()),
|
|
66
|
+
FOREIGN KEY(mission_id) REFERENCES missions(id) ON DELETE CASCADE
|
|
67
|
+
);
|
|
68
|
+
|
|
69
|
+
-- Indexes
|
|
70
|
+
CREATE INDEX IF NOT EXISTS idx_intent_mission ON intent_logs(mission_id);
|
|
71
|
+
CREATE INDEX IF NOT EXISTS idx_intent_symbol ON intent_logs(symbol_id);
|
|
72
|
+
CREATE INDEX IF NOT EXISTS idx_working_set_mission ON working_set(mission_id);
|
|
73
|
+
CREATE INDEX IF NOT EXISTS idx_cross_repo_mission ON cross_repo_links(mission_id);
|
|
74
|
+
CREATE INDEX IF NOT EXISTS idx_mission_artifacts_mission ON mission_artifacts(mission_id);
|
|
75
|
+
|
|
76
|
+
-- DOWN
|
|
77
|
+
DROP INDEX IF EXISTS idx_mission_artifacts_mission;
|
|
78
|
+
DROP INDEX IF EXISTS idx_cross_repo_mission;
|
|
79
|
+
DROP INDEX IF EXISTS idx_working_set_mission;
|
|
80
|
+
DROP INDEX IF EXISTS idx_intent_symbol;
|
|
81
|
+
DROP INDEX IF EXISTS idx_intent_mission;
|
|
82
|
+
DROP TABLE IF EXISTS cross_repo_links;
|
|
83
|
+
DROP TABLE IF EXISTS working_set;
|
|
84
|
+
DROP TABLE IF EXISTS intent_logs;
|
|
85
|
+
DROP TABLE IF EXISTS mission_artifacts;
|
|
86
|
+
DROP TABLE IF EXISTS missions;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
-- UP
|
|
2
|
+
CREATE TABLE IF NOT EXISTS event_synapses (
|
|
3
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
4
|
+
type TEXT NOT NULL, -- 'socket_event' or 'api_route'
|
|
5
|
+
name TEXT NOT NULL, -- The string contract (e.g., 'user:created' or '/api/users')
|
|
6
|
+
direction TEXT NOT NULL, -- 'produce' or 'consume'
|
|
7
|
+
file_path TEXT NOT NULL,
|
|
8
|
+
line_number INTEGER,
|
|
9
|
+
code_snippet TEXT,
|
|
10
|
+
created_at REAL DEFAULT (unixepoch())
|
|
11
|
+
);
|
|
12
|
+
|
|
13
|
+
CREATE INDEX IF NOT EXISTS idx_events_name ON event_synapses(name);
|
|
14
|
+
CREATE INDEX IF NOT EXISTS idx_events_file ON event_synapses(file_path);
|
|
15
|
+
|
|
16
|
+
-- DOWN
|
|
17
|
+
DROP TABLE IF EXISTS event_synapses;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
-- Add metadata table to track index completion status
|
|
2
|
+
|
|
3
|
+
CREATE TABLE IF NOT EXISTS index_metadata (
|
|
4
|
+
key TEXT PRIMARY KEY,
|
|
5
|
+
value TEXT,
|
|
6
|
+
updated_at REAL DEFAULT (unixepoch())
|
|
7
|
+
);
|
|
8
|
+
|
|
9
|
+
-- Insert initial indexing state marker
|
|
10
|
+
INSERT OR IGNORE INTO index_metadata (key, value) VALUES ('index_completed', 'false');
|
|
11
|
+
INSERT OR IGNORE INTO index_metadata (key, value) VALUES ('index_version', '1');
|
|
12
|
+
INSERT OR IGNORE INTO index_metadata (key, value) VALUES ('last_indexed_at', NULL);
|
|
13
|
+
|
|
14
|
+
-- DOWN
|
|
15
|
+
DROP TABLE IF EXISTS index_metadata;
|