amalfa 1.0.1 → 1.0.3
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/README.md +226 -263
- package/package.json +6 -3
- package/polyvis.settings.json.bak +38 -0
- package/src/cli.ts +103 -21
- package/src/config/defaults.ts +52 -12
- package/src/core/VectorEngine.ts +18 -9
- package/src/mcp/index.ts +62 -7
- package/src/resonance/DatabaseFactory.ts +3 -4
- package/src/resonance/db.ts +4 -4
- package/src/resonance/services/vector-daemon.ts +151 -0
- package/src/utils/DaemonManager.ts +147 -0
- package/src/utils/ZombieDefense.ts +5 -1
- package/:memory: +0 -0
- package/:memory:-shm +0 -0
- package/:memory:-wal +0 -0
- package/CHANGELOG.md.old +0 -43
- package/README.old.md +0 -112
- package/ROADMAP.md +0 -316
- package/TEST_PLAN.md +0 -561
- package/agents.config.json +0 -11
- package/docs/AGENT_PROTOCOLS.md +0 -28
- package/docs/ARCHITECTURAL_OVERVIEW.md +0 -123
- package/docs/BENTO_BOXING_DEPRECATION.md +0 -281
- package/docs/Bun-SQLite.html +0 -464
- package/docs/COMMIT_GUIDELINES.md +0 -367
- package/docs/DEVELOPER_ONBOARDING.md +0 -36
- package/docs/Graph and Vector Database Best Practices.md +0 -214
- package/docs/PERFORMANCE_BASELINES.md +0 -88
- package/docs/REPOSITORY_CLEANUP_SUMMARY.md +0 -261
- package/docs/edge-generation-methods.md +0 -57
- package/docs/elevator-pitch.md +0 -118
- package/docs/graph-and-vector-database-playbook.html +0 -480
- package/docs/hardened-sqlite.md +0 -85
- package/docs/headless-knowledge-management.md +0 -79
- package/docs/john-kaye-flux-prompt.md +0 -46
- package/docs/keyboard-shortcuts.md +0 -80
- package/docs/opinion-proceed-pattern.md +0 -29
- package/docs/polyvis-nodes-edges-schema.md +0 -77
- package/docs/protocols/lab-protocol.md +0 -30
- package/docs/reaction-iquest-loop-coder.md +0 -46
- package/docs/services.md +0 -60
- package/docs/sqlite-wal-readonly-trap.md +0 -228
- package/docs/strategy/css-architecture.md +0 -40
- package/docs/test-document-cycle.md +0 -83
- package/docs/test_lifecycle_E2E.md +0 -4
- package/docs/the-bicameral-graph.md +0 -83
- package/docs/user-guide.md +0 -70
- package/docs/vision-helper.md +0 -53
- package/drizzle/0000_minor_iron_fist.sql +0 -19
- package/drizzle/meta/0000_snapshot.json +0 -139
- package/drizzle/meta/_journal.json +0 -13
- package/example_usage.ts +0 -39
- package/experiment.sh +0 -35
- package/hello +0 -2
- package/index.html +0 -52
- package/knowledge/excalibur.md +0 -12
- package/plans/experience-graph-integration.md +0 -60
- package/prompts/gemini-king-mode-prompt.md +0 -46
- package/public/docs/MCP_TOOLS.md +0 -372
- package/schemas/README.md +0 -20
- package/schemas/cda.schema.json +0 -84
- package/schemas/conceptual-lexicon.schema.json +0 -75
- package/scratchpads/dummy-debrief-boxed.md +0 -39
- package/scratchpads/dummy-debrief.md +0 -27
- package/scratchpads/scratchpad-design.md +0 -50
- package/scratchpads/scratchpad-scrolling.md +0 -20
- package/scratchpads/scratchpad-toc-disappearance.md +0 -23
- package/scratchpads/scratchpad-toc.md +0 -28
- package/scratchpads/test_gardener.md +0 -7
- package/src/core/LLMClient.ts +0 -93
- package/src/core/TagEngine.ts +0 -56
- package/src/db/schema.ts +0 -46
- package/src/gardeners/AutoTagger.ts +0 -116
- package/src/pipeline/HarvesterPipeline.ts +0 -101
- package/src/pipeline/Ingestor.ts +0 -555
- package/src/resonance/cli/ingest.ts +0 -41
- package/src/resonance/cli/migrate.ts +0 -54
- package/src/resonance/config.ts +0 -40
- package/src/resonance/daemon.ts +0 -236
- package/src/resonance/pipeline/extract.ts +0 -89
- package/src/resonance/pipeline/transform_docs.ts +0 -60
- package/src/resonance/services/tokenizer.ts +0 -159
- package/src/resonance/transform/cda.ts +0 -393
- package/src/utils/EnvironmentVerifier.ts +0 -67
- package/substack/substack-playbook-1.md +0 -95
- package/substack/substack-playbook-2.md +0 -78
- package/tasks/ui-investigation.md +0 -26
- package/test-db +0 -0
- package/test-db-shm +0 -0
- package/test-db-wal +0 -0
- package/tests/canary/verify_pinch_check.ts +0 -44
- package/tests/fixtures/ingest_test.md +0 -12
- package/tests/fixtures/ingest_test_boxed.md +0 -13
- package/tests/fixtures/safety_test.md +0 -45
- package/tests/fixtures/safety_test_boxed.md +0 -49
- package/tests/fixtures/tagged_output.md +0 -49
- package/tests/fixtures/tagged_test.md +0 -49
- package/tests/mcp-server-settings.json +0 -8
- package/verify-embedder.ts +0 -54
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: Test Document for Full Cycle Verification
|
|
3
|
-
date: 2025-12-17
|
|
4
|
-
tags: [test, verification, integration]
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
# Test Document for Full Cycle Verification
|
|
8
|
-
|
|
9
|
-
This document tests the complete PolyVis ingestion and processing cycle.
|
|
10
|
-
|
|
11
|
-
## Purpose
|
|
12
|
-
|
|
13
|
-
Verify that all systems work together:
|
|
14
|
-
1. **Dev Server** - CSS/JS watching and web serving
|
|
15
|
-
2. **Daemon** - File watching and automatic ingestion
|
|
16
|
-
3. **MCP Server** - API for AI tool integration
|
|
17
|
-
|
|
18
|
-
## Test Scenario
|
|
19
|
-
|
|
20
|
-
When this document is saved:
|
|
21
|
-
- Daemon detects the change within 2 seconds
|
|
22
|
-
- Triggers debounced ingestion
|
|
23
|
-
- Document is parsed and normalized
|
|
24
|
-
- Entities are extracted
|
|
25
|
-
- Embeddings are generated
|
|
26
|
-
- Graph nodes and edges are created
|
|
27
|
-
- Database is updated
|
|
28
|
-
- MCP server can query the new data
|
|
29
|
-
|
|
30
|
-
## Expected Behavior
|
|
31
|
-
|
|
32
|
-
### Daemon Log Output:
|
|
33
|
-
```
|
|
34
|
-
📝 Change detected: docs/test-document-cycle.md (change)
|
|
35
|
-
🔄 Debounce settle. Starting Batch Ingestion (1 files)...
|
|
36
|
-
✅ Batch Ingestion Complete.
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
### Database Updates:
|
|
40
|
-
- New node created for this document
|
|
41
|
-
- Embeddings generated for content
|
|
42
|
-
- Edges created to related concepts
|
|
43
|
-
|
|
44
|
-
### MCP Accessibility:
|
|
45
|
-
- Document searchable via MCP search tool
|
|
46
|
-
- Content retrievable via MCP read tool
|
|
47
|
-
|
|
48
|
-
## Key Concepts
|
|
49
|
-
|
|
50
|
-
This document mentions several concepts to test entity extraction:
|
|
51
|
-
- **Ingestion Pipeline** - The data processing workflow
|
|
52
|
-
- **Vector Embeddings** - Semantic representation of text
|
|
53
|
-
- **Knowledge Graph** - Connected nodes and edges
|
|
54
|
-
- **Real-time Processing** - Immediate response to file changes
|
|
55
|
-
|
|
56
|
-
## Verification
|
|
57
|
-
|
|
58
|
-
After saving this document:
|
|
59
|
-
1. Check `.daemon.log` for ingestion messages
|
|
60
|
-
2. Query database for this document's node
|
|
61
|
-
3. Test MCP search for "Full Cycle Verification"
|
|
62
|
-
4. Verify graph visualization shows new node
|
|
63
|
-
|
|
64
|
-
## Success Criteria
|
|
65
|
-
|
|
66
|
-
✅ Daemon detects file within 2 seconds
|
|
67
|
-
✅ Ingestion completes without errors
|
|
68
|
-
✅ Node created with correct title
|
|
69
|
-
✅ Embeddings generated successfully
|
|
70
|
-
✅ MCP search returns this document
|
|
71
|
-
✅ No error messages in any service logs
|
|
72
|
-
|
|
73
|
-
---
|
|
74
|
-
|
|
75
|
-
**Status:** Testing in progress...
|
|
76
|
-
**Last Updated:** 2025-12-17 20:09:00
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
## Updated at Wed 17 Dec 2025 20:11:36 GMT
|
|
80
|
-
|
|
81
|
-
## Trigger at 20:12:55
|
|
82
|
-
|
|
83
|
-
## Another update at 20:13:21
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
### Opinion: The Architecture of the Breakdown
|
|
2
|
-
|
|
3
|
-
This is the most important document you will write for the project's "Soul."
|
|
4
|
-
|
|
5
|
-
Most engineering blogs are boring because they talk about *how* (The Stack). This report talks about *why* (The Mind). By framing your search architecture through the lens of Julian Jaynes, you elevate a standard "Hybrid Search" implementation into a philosophical stance on the nature of machine intelligence.
|
|
6
|
-
|
|
7
|
-
It neatly explains why RAG (Retrieval Augmented Generation) often fails: it is usually just a lobotomy—using only the "Right Brain" (Vectors) and wondering why the facts are wrong, or using only the "Left Brain" (Keywords) and wondering why the context is missing.
|
|
8
|
-
|
|
9
|
-
Here is the draft for **`docs/philosophy/THE_BICAMERAL_GRAPH.md`**.
|
|
10
|
-
|
|
11
|
-
---
|
|
12
|
-
|
|
13
|
-
# The Bicameral Graph: Engineering Resonance in a Hollow Substrate
|
|
14
|
-
|
|
15
|
-
**Date:** Jan 2026
|
|
16
|
-
**Project:** PolyVis
|
|
17
|
-
**Context:** Architectural Philosophy
|
|
18
|
-
|
|
19
|
-
---
|
|
20
|
-
|
|
21
|
-
## 1. The Silence of the Vectors
|
|
22
|
-
|
|
23
|
-
In his 1976 treatise *The Origin of Consciousness in the Breakdown of the Bicameral Mind*, Julian Jaynes proposed a controversial theory: that early humans were not "conscious" in the modern sense. Instead, their minds were split. The right hemisphere generated auditory hallucinations (the "Voice of the God") based on stress or context, and the left hemisphere obeyed them without question. Consciousness, Jaynes argued, arose only when the two sides learned to talk to each other—when the "Command" met "Reason."
|
|
24
|
-
|
|
25
|
-
Modern AI is currently stuck in the pre-breakdown phase.
|
|
26
|
-
|
|
27
|
-
* **LLMs (The Gods):** They are pure, hallucinating Right Hemispheres. They dream in high-dimensional vector space. They understand "vibes," associations, and intent, but they have no concept of "truth."
|
|
28
|
-
* **Symbolic Logic (The Scribe):** Tools like `grep`, SQL, and Compilers are pure Left Hemispheres. They are rigid, precise, and fact-based, but they are deaf to nuance.
|
|
29
|
-
|
|
30
|
-
Most "AI Search" tools today make the mistake of choosing one side. They either drown in the fuzzy hallucinations of Vector Search (RAG) or suffocate in the rigidity of Keyword Search.
|
|
31
|
-
|
|
32
|
-
**PolyVis takes a different approach. We are engineering the Breakdown.**
|
|
33
|
-
|
|
34
|
-
## 2. The Anatomy of the Resonance Engine
|
|
35
|
-
|
|
36
|
-
To build a codebase navigator that actually works—one that feels "intelligent"—we separate the search process into two distinct cognitive hemispheres.
|
|
37
|
-
|
|
38
|
-
### The Right Hemisphere: The Embedding Field (`model2vec`)
|
|
39
|
-
|
|
40
|
-
* **The Function:** Fuzzy Pattern Matching.
|
|
41
|
-
* **The Query:** "Where is the authentication logic?"
|
|
42
|
-
* **The Operation:** We scan the high-dimensional latent space of the graph. The system doesn't look for the word "Authentication"; it looks for the *concept* of security, logins, and tokens.
|
|
43
|
-
* **The Output:** A "Vibe Cluster." A list of 50 files that *feel* relevant.
|
|
44
|
-
* **The Deficit:** It cannot tell you line numbers. It cannot distinguish between a variable named `auth` and a comment about `authoring`. It is a dream.
|
|
45
|
-
|
|
46
|
-
### The Left Hemisphere: The Super-Grep (`ripgrep` / Regex)
|
|
47
|
-
|
|
48
|
-
* **The Function:** Deterministic Symbol Verification.
|
|
49
|
-
* **The Query:** `match "function validate.*Token"`
|
|
50
|
-
* **The Operation:** A brutal, byte-level scan of the filesystem. It cares nothing for intent. It only knows ASCII.
|
|
51
|
-
* **The Output:** "File `auth.ts`, Line 45, Column 12."
|
|
52
|
-
* **The Deficit:** It requires you to know exactly what you are looking for. If you typo the regex, it returns silence. It is a machine.
|
|
53
|
-
|
|
54
|
-
## 3. The "Breakdown" (The Orchestrator)
|
|
55
|
-
|
|
56
|
-
In PolyVis, "Search" is not a retrieval task; it is a **Resonance Event**.
|
|
57
|
-
|
|
58
|
-
We do not return the results of the Embeddings *or* the Grep. We feed them into the **Orchestrator** (The Corpus Callosum). This is where the "Breakdown" happens.
|
|
59
|
-
|
|
60
|
-
1. **Vibration:** The Right Brain identifies a cluster of files with the correct "semantic shape."
|
|
61
|
-
2. **Validation:** The Left Brain scans *only that cluster* for precise "structural anchors" (function definitions, variable flows).
|
|
62
|
-
3. **Constructive Interference:** Where the Vibe matches the Fact, we get **Resonance**.
|
|
63
|
-
|
|
64
|
-
If the Embeddings say "This is Auth" and the Grep says "Here is `validateToken`," the Orchestrator **Reifies** a new node in the graph: *"The Authentication Logic Node (Ephemeral)."*
|
|
65
|
-
|
|
66
|
-
## 4. The Hollow Node Strategy
|
|
67
|
-
|
|
68
|
-
This approach enables our **Hollow Node** architecture. We do not need to fill our database with every line of code (bloating the graph). We keep the nodes "Hollow" (Metadata only).
|
|
69
|
-
|
|
70
|
-
* **Resting State:** The graph is quiet. Nodes are just file paths.
|
|
71
|
-
* **Active State:** When a user queries, the Bicameral Mind wakes up. It scans, cross-references, and fills the hollow nodes with the specific code snippets relevant *only to that query*.
|
|
72
|
-
|
|
73
|
-
## Conclusion: Artificial Consciousness
|
|
74
|
-
|
|
75
|
-
We are not building a search engine. A search engine gives you a list of links.
|
|
76
|
-
We are building a **Cognitive Overlay**.
|
|
77
|
-
|
|
78
|
-
By forcing the "Dreaming" LLM to submit to the "Rigid" Grep, we create a system that possesses the intuition of a Senior Engineer and the precision of a Compiler. It is the breakdown of the bicameral mind, weaponized for software engineering.
|
|
79
|
-
|
|
80
|
-
---
|
|
81
|
-
|
|
82
|
-
**Next Step:**
|
|
83
|
-
Shall I commit this to the repo under `docs/philosophy`? It serves as the "constitution" for the Super-Grep agent we build next.
|
package/docs/user-guide.md
DELETED
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
# PolyVis User Guide
|
|
2
|
-
|
|
3
|
-
Welcome to **PolyVis**, a local-first Knowledge Graph engine and MCP Server.
|
|
4
|
-
|
|
5
|
-
## 1. Quick Start
|
|
6
|
-
|
|
7
|
-
### Installation
|
|
8
|
-
**Requirement:** [Bun](https://bun.sh) is **mandatory** for this project.
|
|
9
|
-
Ensure you have Bun installed.
|
|
10
|
-
```bash
|
|
11
|
-
bun install
|
|
12
|
-
```
|
|
13
|
-
|
|
14
|
-
### Initial Data Ingestion
|
|
15
|
-
Before running the server, you must ingest your Markdown documents and generate vectors.
|
|
16
|
-
```bash
|
|
17
|
-
bun run build:data
|
|
18
|
-
```
|
|
19
|
-
*Note: This process uses local embeddings (AllMiniLML6V2) and may take a moment on the first run.*
|
|
20
|
-
|
|
21
|
-
### Running the MCP Server
|
|
22
|
-
To expose the knowledge graph to your AI agent (like Claude Desktop or other MCP clients):
|
|
23
|
-
```bash
|
|
24
|
-
bun run mcp
|
|
25
|
-
```
|
|
26
|
-
This starts the server on `stdio`.
|
|
27
|
-
|
|
28
|
-
## 2. Core Features
|
|
29
|
-
|
|
30
|
-
### Knowledge Graph
|
|
31
|
-
Your data is stored in `public/resonance.db`. This includes:
|
|
32
|
-
- **Nodes:** Parsed from your Markdown files (Experience, Playbooks, Debriefs).
|
|
33
|
-
- **Edges:** Automatically woven based on semantic similarity and explicit tags.
|
|
34
|
-
- **Vectors:** Local embeddings for semantic search.
|
|
35
|
-
|
|
36
|
-
### Hybrid Search
|
|
37
|
-
The system uses a **Hybrid Search** mechanism combining:
|
|
38
|
-
1. **Vector Search:** Semantic understanding (e.g., "how to fix timeout").
|
|
39
|
-
2. **FTS (Full-Text Search):** Keyword matching (e.g., "timeout error 500").
|
|
40
|
-
|
|
41
|
-
### Visualization
|
|
42
|
-
To explore the graph visually in your browser:
|
|
43
|
-
```bash
|
|
44
|
-
bun run dev
|
|
45
|
-
```
|
|
46
|
-
Visit `http://localhost:3000`.
|
|
47
|
-
|
|
48
|
-
## 3. Advanced Usage
|
|
49
|
-
|
|
50
|
-
### Vector Daemon (Optional)
|
|
51
|
-
For heavy ingestion workloads, you can run the Vector Daemon in the background to keep the embedding model loaded in memory:
|
|
52
|
-
```bash
|
|
53
|
-
bun run resonance/src/daemon.ts
|
|
54
|
-
```
|
|
55
|
-
The ingestion scripts will automatically detect and use the daemon if it's running on port 3010.
|
|
56
|
-
|
|
57
|
-
### Re-Indexing
|
|
58
|
-
If you add or modify files, simply run:
|
|
59
|
-
```bash
|
|
60
|
-
bun run build:data
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
## 4. Troubleshooting
|
|
64
|
-
|
|
65
|
-
**"Search returns empty results"**
|
|
66
|
-
- Ensure you ran `bun run build:data`.
|
|
67
|
-
- Check `public/resonance.db` exists.
|
|
68
|
-
|
|
69
|
-
**"VectorEngine Error"**
|
|
70
|
-
- Ensure no other process is blocking the database.
|
package/docs/vision-helper.md
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
Please implement a "Vision Helper" script to help you read our Terminal Brutalist design system programmatically.
|
|
2
|
-
|
|
3
|
-
TASK:
|
|
4
|
-
Inject the following JavaScript code into the bottom of our main `index.html` (before the closing </body> tag) or our main entry script.
|
|
5
|
-
|
|
6
|
-
CONTEXT:
|
|
7
|
-
We use a high-contrast "Terminal Brutalist" theme with strict ANSI colors. Since `getComputedStyle` is hard for agents to deduce during interaction, this script exposes a global `window.__AGENT_THEME__` object containing our exact palette and interaction rules.
|
|
8
|
-
|
|
9
|
-
CODE TO INJECT:
|
|
10
|
-
|
|
11
|
-
<script>
|
|
12
|
-
// AGENT VISIBILITY HELPER
|
|
13
|
-
// Exposes the "Terminal Brutalist" theme so agents can read resolved styles.
|
|
14
|
-
window.__AGENT_THEME__ = (() => {
|
|
15
|
-
const root = getComputedStyle(document.documentElement);
|
|
16
|
-
const getVar = (name) => root.getPropertyValue(name).trim();
|
|
17
|
-
|
|
18
|
-
return {
|
|
19
|
-
system: "PolyVis Terminal Brutalist",
|
|
20
|
-
palette: {
|
|
21
|
-
canvas: getVar('--ansi-black'), // #0C0C0C
|
|
22
|
-
text: getVar('--ansi-white'), // #CCCCCC
|
|
23
|
-
highlight: getVar('--ansi-bright-white'),// #FFFFFF
|
|
24
|
-
error: getVar('--ansi-red'), // #C50F1F
|
|
25
|
-
success: getVar('--ansi-green'), // #16C60C
|
|
26
|
-
warning: getVar('--ansi-yellow'), // #C19C00
|
|
27
|
-
agent: getVar('--ansi-orange'), // #FF8C00 (The "Ghost in the Machine")
|
|
28
|
-
},
|
|
29
|
-
rules: {
|
|
30
|
-
borderRadius: '0px', // HARD RULE: No rounded corners.
|
|
31
|
-
fontFamily: getVar('--font-mono'),
|
|
32
|
-
borders: '2px solid', // HARD RULE: Thick borders only.
|
|
33
|
-
},
|
|
34
|
-
// The "Hover State" cheat sheet for interaction
|
|
35
|
-
interactive: {
|
|
36
|
-
button: {
|
|
37
|
-
description: "Hard inversion on hover. Instant transition.",
|
|
38
|
-
default: {
|
|
39
|
-
bg: getVar('--ansi-black'),
|
|
40
|
-
text: getVar('--ansi-white'),
|
|
41
|
-
border: getVar('--ansi-white')
|
|
42
|
-
},
|
|
43
|
-
hover: {
|
|
44
|
-
bg: getVar('--ansi-white'),
|
|
45
|
-
text: getVar('--ansi-black'),
|
|
46
|
-
border: getVar('--ansi-white')
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
})();
|
|
52
|
-
console.log('%c[AGENT_THEME] System Visible', 'color: #FF8C00');
|
|
53
|
-
</script>
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
CREATE TABLE `edges` (
|
|
2
|
-
`source` text NOT NULL,
|
|
3
|
-
`target` text NOT NULL,
|
|
4
|
-
`type` text NOT NULL,
|
|
5
|
-
`metadata` text
|
|
6
|
-
);
|
|
7
|
-
--> statement-breakpoint
|
|
8
|
-
CREATE TABLE `nodes` (
|
|
9
|
-
`id` text PRIMARY KEY NOT NULL,
|
|
10
|
-
`type` text NOT NULL,
|
|
11
|
-
`title` text,
|
|
12
|
-
`content` text,
|
|
13
|
-
`domain` text DEFAULT 'knowledge',
|
|
14
|
-
`layer` text DEFAULT 'experience',
|
|
15
|
-
`order_index` integer DEFAULT 0,
|
|
16
|
-
`metadata` text,
|
|
17
|
-
`external_refs` text,
|
|
18
|
-
`embedding` blob
|
|
19
|
-
);
|
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": "6",
|
|
3
|
-
"dialect": "sqlite",
|
|
4
|
-
"id": "96582325-8a88-4ffb-872a-43699e33324c",
|
|
5
|
-
"prevId": "00000000-0000-0000-0000-000000000000",
|
|
6
|
-
"tables": {
|
|
7
|
-
"edges": {
|
|
8
|
-
"name": "edges",
|
|
9
|
-
"columns": {
|
|
10
|
-
"source": {
|
|
11
|
-
"name": "source",
|
|
12
|
-
"type": "text",
|
|
13
|
-
"primaryKey": false,
|
|
14
|
-
"notNull": true,
|
|
15
|
-
"autoincrement": false
|
|
16
|
-
},
|
|
17
|
-
"target": {
|
|
18
|
-
"name": "target",
|
|
19
|
-
"type": "text",
|
|
20
|
-
"primaryKey": false,
|
|
21
|
-
"notNull": true,
|
|
22
|
-
"autoincrement": false
|
|
23
|
-
},
|
|
24
|
-
"type": {
|
|
25
|
-
"name": "type",
|
|
26
|
-
"type": "text",
|
|
27
|
-
"primaryKey": false,
|
|
28
|
-
"notNull": true,
|
|
29
|
-
"autoincrement": false
|
|
30
|
-
},
|
|
31
|
-
"metadata": {
|
|
32
|
-
"name": "metadata",
|
|
33
|
-
"type": "text",
|
|
34
|
-
"primaryKey": false,
|
|
35
|
-
"notNull": false,
|
|
36
|
-
"autoincrement": false
|
|
37
|
-
}
|
|
38
|
-
},
|
|
39
|
-
"indexes": {},
|
|
40
|
-
"foreignKeys": {},
|
|
41
|
-
"compositePrimaryKeys": {},
|
|
42
|
-
"uniqueConstraints": {},
|
|
43
|
-
"checkConstraints": {}
|
|
44
|
-
},
|
|
45
|
-
"nodes": {
|
|
46
|
-
"name": "nodes",
|
|
47
|
-
"columns": {
|
|
48
|
-
"id": {
|
|
49
|
-
"name": "id",
|
|
50
|
-
"type": "text",
|
|
51
|
-
"primaryKey": true,
|
|
52
|
-
"notNull": true,
|
|
53
|
-
"autoincrement": false
|
|
54
|
-
},
|
|
55
|
-
"type": {
|
|
56
|
-
"name": "type",
|
|
57
|
-
"type": "text",
|
|
58
|
-
"primaryKey": false,
|
|
59
|
-
"notNull": true,
|
|
60
|
-
"autoincrement": false
|
|
61
|
-
},
|
|
62
|
-
"title": {
|
|
63
|
-
"name": "title",
|
|
64
|
-
"type": "text",
|
|
65
|
-
"primaryKey": false,
|
|
66
|
-
"notNull": false,
|
|
67
|
-
"autoincrement": false
|
|
68
|
-
},
|
|
69
|
-
"content": {
|
|
70
|
-
"name": "content",
|
|
71
|
-
"type": "text",
|
|
72
|
-
"primaryKey": false,
|
|
73
|
-
"notNull": false,
|
|
74
|
-
"autoincrement": false
|
|
75
|
-
},
|
|
76
|
-
"domain": {
|
|
77
|
-
"name": "domain",
|
|
78
|
-
"type": "text",
|
|
79
|
-
"primaryKey": false,
|
|
80
|
-
"notNull": false,
|
|
81
|
-
"autoincrement": false,
|
|
82
|
-
"default": "'knowledge'"
|
|
83
|
-
},
|
|
84
|
-
"layer": {
|
|
85
|
-
"name": "layer",
|
|
86
|
-
"type": "text",
|
|
87
|
-
"primaryKey": false,
|
|
88
|
-
"notNull": false,
|
|
89
|
-
"autoincrement": false,
|
|
90
|
-
"default": "'experience'"
|
|
91
|
-
},
|
|
92
|
-
"order_index": {
|
|
93
|
-
"name": "order_index",
|
|
94
|
-
"type": "integer",
|
|
95
|
-
"primaryKey": false,
|
|
96
|
-
"notNull": false,
|
|
97
|
-
"autoincrement": false,
|
|
98
|
-
"default": 0
|
|
99
|
-
},
|
|
100
|
-
"metadata": {
|
|
101
|
-
"name": "metadata",
|
|
102
|
-
"type": "text",
|
|
103
|
-
"primaryKey": false,
|
|
104
|
-
"notNull": false,
|
|
105
|
-
"autoincrement": false
|
|
106
|
-
},
|
|
107
|
-
"external_refs": {
|
|
108
|
-
"name": "external_refs",
|
|
109
|
-
"type": "text",
|
|
110
|
-
"primaryKey": false,
|
|
111
|
-
"notNull": false,
|
|
112
|
-
"autoincrement": false
|
|
113
|
-
},
|
|
114
|
-
"embedding": {
|
|
115
|
-
"name": "embedding",
|
|
116
|
-
"type": "blob",
|
|
117
|
-
"primaryKey": false,
|
|
118
|
-
"notNull": false,
|
|
119
|
-
"autoincrement": false
|
|
120
|
-
}
|
|
121
|
-
},
|
|
122
|
-
"indexes": {},
|
|
123
|
-
"foreignKeys": {},
|
|
124
|
-
"compositePrimaryKeys": {},
|
|
125
|
-
"uniqueConstraints": {},
|
|
126
|
-
"checkConstraints": {}
|
|
127
|
-
}
|
|
128
|
-
},
|
|
129
|
-
"views": {},
|
|
130
|
-
"enums": {},
|
|
131
|
-
"_meta": {
|
|
132
|
-
"schemas": {},
|
|
133
|
-
"tables": {},
|
|
134
|
-
"columns": {}
|
|
135
|
-
},
|
|
136
|
-
"internal": {
|
|
137
|
-
"indexes": {}
|
|
138
|
-
}
|
|
139
|
-
}
|
package/example_usage.ts
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
// example_usage.ts
|
|
2
|
-
import { EnlightenedProvider } from "./src/llm/EnlightenedProvider";
|
|
3
|
-
|
|
4
|
-
async function main() {
|
|
5
|
-
// 1. Initialize the Accountant
|
|
6
|
-
const hume = new EnlightenedProvider({ port: 8083 });
|
|
7
|
-
|
|
8
|
-
// 2. Check Pulse
|
|
9
|
-
if (!(await hume.isOnline())) {
|
|
10
|
-
console.error(
|
|
11
|
-
"⚠️ The Enlightenment Server is offline. Run the Golden Command.",
|
|
12
|
-
);
|
|
13
|
-
return;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
console.log("🟢 Enlightenment Engine Online.\n");
|
|
17
|
-
|
|
18
|
-
// 3. Scenario A: The Logic Check
|
|
19
|
-
console.log("--- TEST A: LOGIC ---");
|
|
20
|
-
const logicResponse = await hume.think([
|
|
21
|
-
{ role: "system", content: "You are a skeptical logician." },
|
|
22
|
-
{
|
|
23
|
-
role: "user",
|
|
24
|
-
content:
|
|
25
|
-
"I walked under a ladder and then tripped. Did the ladder cause me to trip?",
|
|
26
|
-
},
|
|
27
|
-
]);
|
|
28
|
-
console.log(`Result: ${logicResponse}\n`);
|
|
29
|
-
|
|
30
|
-
// 4. Scenario B: The "De-Fluff" Tool
|
|
31
|
-
console.log("--- TEST B: DE-FLUFFING ---");
|
|
32
|
-
const corporateJargon =
|
|
33
|
-
"We need to leverage our core competencies to shift the paradigm and boil the ocean.";
|
|
34
|
-
const cleanText = await hume.defluff(corporateJargon);
|
|
35
|
-
console.log(`Original: "${corporateJargon}"`);
|
|
36
|
-
console.log(`Cleaned: "${cleanText}"`);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
main();
|
package/experiment.sh
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
|
|
3
|
-
# 1. Create the Hazard Lab
|
|
4
|
-
mkdir -p experiments/enlightenment
|
|
5
|
-
cd experiments/enlightenment
|
|
6
|
-
|
|
7
|
-
# 2. Update .gitignore (Crucial: Don't commit 10GB of AI)
|
|
8
|
-
# We append to the root .gitignore if these rules aren't there
|
|
9
|
-
if ! grep -q "experiments/enlightenment/models" ../../.gitignore; then
|
|
10
|
-
echo -e "\n# Enlightenment Experiment\nexperiments/enlightenment/models/\nexperiments/enlightenment/venv/\nexperiments/enlightenment/__pycache__/\n*.gguf" >> ../../.gitignore
|
|
11
|
-
echo "✅ Added safety rules to .gitignore"
|
|
12
|
-
fi
|
|
13
|
-
|
|
14
|
-
# 3. Create Python Virtual Environment
|
|
15
|
-
echo "🐍 Setting up Python environment..."
|
|
16
|
-
python3 -m venv venv
|
|
17
|
-
source venv/bin/activate
|
|
18
|
-
|
|
19
|
-
# 4. Install Dependencies
|
|
20
|
-
# repeng: The control vector library
|
|
21
|
-
# torch/transformers: For calculating the vector
|
|
22
|
-
echo "⬇️ Installing PyTorch and Transformers (this may take a minute)..."
|
|
23
|
-
pip install torch transformers repeng tqdm notebook
|
|
24
|
-
|
|
25
|
-
# 5. Clone llama.cpp (for the server)
|
|
26
|
-
if [ ! -d "llama.cpp" ]; then
|
|
27
|
-
echo "🏗️ Cloning and building llama.cpp..."
|
|
28
|
-
git clone https://github.com/ggerganov/llama.cpp
|
|
29
|
-
cd llama.cpp
|
|
30
|
-
make -j4 # Build the server
|
|
31
|
-
cd ..
|
|
32
|
-
fi
|
|
33
|
-
|
|
34
|
-
echo "✅ Environment Ready in experiments/enlightenment/"
|
|
35
|
-
echo " Next Step: Download the Llama-3 Model."
|
package/hello
DELETED
package/index.html
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
<!doctype html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
|
|
4
|
-
<head>
|
|
5
|
-
<meta charset="UTF-8" />
|
|
6
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
|
-
<title>Polyvis</title>
|
|
8
|
-
<link rel="stylesheet" href="public/css/app.css" />
|
|
9
|
-
<script defer src="public/js/app.js"></script>
|
|
10
|
-
</head>
|
|
11
|
-
|
|
12
|
-
<body>
|
|
13
|
-
<main class="container">
|
|
14
|
-
<h1>Welcome to Polyvis</h1>
|
|
15
|
-
<p>This is the beginning of our web project.</p>
|
|
16
|
-
|
|
17
|
-
<section style="margin-top: var(--size-8);">
|
|
18
|
-
<h2>Integration Demo</h2>
|
|
19
|
-
|
|
20
|
-
<!-- RAM Grid -->
|
|
21
|
-
<div class="card-grid">
|
|
22
|
-
<article class="p-4 border border-surface-2 rounded bg-surface-1">
|
|
23
|
-
<h3>Card 1</h3>
|
|
24
|
-
<p>Responsive card using RAM pattern.</p>
|
|
25
|
-
</article>
|
|
26
|
-
<article class="p-4 border border-surface-2 rounded bg-surface-1">
|
|
27
|
-
<h3>Card 2</h3>
|
|
28
|
-
<p>Responsive card using RAM pattern.</p>
|
|
29
|
-
</article>
|
|
30
|
-
<article class="p-4 border border-surface-2 rounded bg-surface-1">
|
|
31
|
-
<h3>Card 3</h3>
|
|
32
|
-
<p>Responsive card using RAM pattern.</p>
|
|
33
|
-
</article>
|
|
34
|
-
</div>
|
|
35
|
-
|
|
36
|
-
<!-- Alpine + Open Props Bridge -->
|
|
37
|
-
<div x-data="{ progress: 50 }" class="mt-8">
|
|
38
|
-
<h3>Interactive Bridge</h3>
|
|
39
|
-
<input type="range" x-model="progress" min="0" max="100" class="w-full">
|
|
40
|
-
<div
|
|
41
|
-
class="h-4 bg-surface-2 rounded mt-2 overflow-hidden"
|
|
42
|
-
:style="{ '--val': progress + '%' }"
|
|
43
|
-
>
|
|
44
|
-
<div class="h-full bg-brand transition-all duration-300" style="width: var(--val)"></div>
|
|
45
|
-
</div>
|
|
46
|
-
<p>Value: <span x-text="progress"></span>%</p>
|
|
47
|
-
</div>
|
|
48
|
-
</section>
|
|
49
|
-
</main>
|
|
50
|
-
</body>
|
|
51
|
-
|
|
52
|
-
</html>
|
package/knowledge/excalibur.md
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: The Sword in the Stone
|
|
3
|
-
type: concept
|
|
4
|
-
tags: [test, excalibur, concurrency]
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
# Excalibur
|
|
8
|
-
|
|
9
|
-
Whosoever pulleth out this sword of this stone and anvil is rightwise king born of all England.
|
|
10
|
-
|
|
11
|
-
The database must hold true while the Daemon writes and the MCP reads.
|
|
12
|
-
If this node is readable, the kingdom is safe.
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
# Plan: Experience Graph Integration (Sidecar Pipeline)
|
|
2
|
-
|
|
3
|
-
**Objective:** Populate `ctx.db` with resonance documents (Playbooks/Debriefs) and visualize them in Sigma Explorer, controlled by `polyvis.settings.json`.
|
|
4
|
-
|
|
5
|
-
## 1. Safety & Verification (First Step)
|
|
6
|
-
We will create a verification script to ensure we don't corrupt the existing Lexicon graph.
|
|
7
|
-
- **Script:** `scripts/verify_graph_integrity.ts`
|
|
8
|
-
- **Checks:**
|
|
9
|
-
- Snapshot node/edge counts of `scripts/ctx.db` before changes.
|
|
10
|
-
- Ensure standard Lexicon nodes (e.g. `OH-001`, `term-001`) exist.
|
|
11
|
-
- After ingestion, verify counts increased and specific connections (Debrief -> Protocol) exist.
|
|
12
|
-
|
|
13
|
-
## 2. Ingestion Logic (The Sidecar)
|
|
14
|
-
We will implement the "Sidecar" pattern as requested to avoid touching `build_db.ts`.
|
|
15
|
-
- **Script:** `scripts/ingest_experience_graph.ts`
|
|
16
|
-
- **Inputs:**
|
|
17
|
-
- `public/data/experience.json` ( Generated by `build_experience.ts`)
|
|
18
|
-
- `scripts/ctx.db` (The base Lexicon graph)
|
|
19
|
-
- **Process:**
|
|
20
|
-
1. Read `polyvis.settings.json` for paths.
|
|
21
|
-
2. Open `scripts/ctx.db`.
|
|
22
|
-
3. Iterate through `experience.json`:
|
|
23
|
-
- **Insert Node**: `id`=Filename, `type`='debrief'|'playbook', `label`=Title, `definition`=Path.
|
|
24
|
-
- **Heuristic Edge Generation**:
|
|
25
|
-
- Read markdown content.
|
|
26
|
-
- Regex `OH-[0-9]{3}`, `PHI-[0-9]+`, `COG-[0-9]+` -> `CITES` edge to Protocol.
|
|
27
|
-
- Regex `[[wikilink]]` -> `REFERENCES` edge.
|
|
28
|
-
4. Copy updated `scripts/ctx.db` to `public/data/ctx.db`.
|
|
29
|
-
|
|
30
|
-
## 3. Visualization (Sigma Explorer)
|
|
31
|
-
We will update the UI to allow toggling this new layer.
|
|
32
|
-
- **File:** `src/js/components/sigma-explorer.js` & `public/sigma-explorer/index.html`
|
|
33
|
-
- **Changes:**
|
|
34
|
-
- **Load Phase**: Ensure `debrief` and `playbook` nodes are loaded but set `hidden: true` by default.
|
|
35
|
-
- **Control**: Add a "Show Experience" toggle in the sidebar.
|
|
36
|
-
- **Style**: Assign distinct colors/sizes for these new node types (e.g. Orange for Playbooks, Blue for Debriefs).
|
|
37
|
-
|
|
38
|
-
## 4. Execution Steps
|
|
39
|
-
1. Create `scripts/verify_graph_integrity.ts`.
|
|
40
|
-
2. Run Baseline Verification.
|
|
41
|
-
3. Create `scripts/ingest_experience_graph.ts`.
|
|
42
|
-
4. Run Ingestion.
|
|
43
|
-
5. Run Post-Verification.
|
|
44
|
-
6. Modify Sigma Explorer UI (`src/js/components/sigma-explorer.js`, `index.html`).
|
|
45
|
-
7. Verify in Browser.
|
|
46
|
-
|
|
47
|
-
## 5. Configuration
|
|
48
|
-
All paths will be derived from `polyvis.settings.json`:
|
|
49
|
-
```json
|
|
50
|
-
{
|
|
51
|
-
"paths": {
|
|
52
|
-
"database": {
|
|
53
|
-
"legacy": "scripts/ctx.db"
|
|
54
|
-
},
|
|
55
|
-
"sources": {
|
|
56
|
-
"docs": ["playbooks/", "debriefs/"]
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
```
|