amalfa 1.0.1 → 1.0.2

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 (83) hide show
  1. package/README.md +226 -263
  2. package/docs/AGENT-METADATA-PATTERNS.md +1021 -0
  3. package/docs/CONFIG_E2E_VALIDATION.md +147 -0
  4. package/docs/CONFIG_UNIFICATION.md +187 -0
  5. package/docs/CONFIG_VALIDATION.md +103 -0
  6. package/docs/LEGACY_DEPRECATION.md +174 -0
  7. package/docs/MCP_SETUP.md +317 -0
  8. package/docs/QUICK_START_MCP.md +168 -0
  9. package/docs/SESSION-2026-01-06-METADATA-PATTERNS.md +346 -0
  10. package/docs/SETUP.md +464 -0
  11. package/docs/SETUP_COMPLETE.md +464 -0
  12. package/docs/VISION-AGENT-LEARNING.md +1242 -0
  13. package/docs/_current-config-status.md +93 -0
  14. package/package.json +6 -3
  15. package/polyvis.settings.json.bak +38 -0
  16. package/src/cli.ts +103 -21
  17. package/src/config/defaults.ts +52 -12
  18. package/src/core/VectorEngine.ts +18 -9
  19. package/src/mcp/index.ts +62 -7
  20. package/src/resonance/DatabaseFactory.ts +3 -4
  21. package/src/resonance/db.ts +4 -4
  22. package/src/resonance/services/vector-daemon.ts +151 -0
  23. package/src/utils/DaemonManager.ts +147 -0
  24. package/src/utils/ZombieDefense.ts +5 -1
  25. package/:memory: +0 -0
  26. package/:memory:-shm +0 -0
  27. package/:memory:-wal +0 -0
  28. package/CHANGELOG.md.old +0 -43
  29. package/README.old.md +0 -112
  30. package/ROADMAP.md +0 -316
  31. package/TEST_PLAN.md +0 -561
  32. package/agents.config.json +0 -11
  33. package/drizzle/0000_minor_iron_fist.sql +0 -19
  34. package/drizzle/meta/0000_snapshot.json +0 -139
  35. package/drizzle/meta/_journal.json +0 -13
  36. package/example_usage.ts +0 -39
  37. package/experiment.sh +0 -35
  38. package/hello +0 -2
  39. package/index.html +0 -52
  40. package/knowledge/excalibur.md +0 -12
  41. package/plans/experience-graph-integration.md +0 -60
  42. package/prompts/gemini-king-mode-prompt.md +0 -46
  43. package/public/docs/MCP_TOOLS.md +0 -372
  44. package/schemas/README.md +0 -20
  45. package/schemas/cda.schema.json +0 -84
  46. package/schemas/conceptual-lexicon.schema.json +0 -75
  47. package/scratchpads/dummy-debrief-boxed.md +0 -39
  48. package/scratchpads/dummy-debrief.md +0 -27
  49. package/scratchpads/scratchpad-design.md +0 -50
  50. package/scratchpads/scratchpad-scrolling.md +0 -20
  51. package/scratchpads/scratchpad-toc-disappearance.md +0 -23
  52. package/scratchpads/scratchpad-toc.md +0 -28
  53. package/scratchpads/test_gardener.md +0 -7
  54. package/src/core/LLMClient.ts +0 -93
  55. package/src/core/TagEngine.ts +0 -56
  56. package/src/db/schema.ts +0 -46
  57. package/src/gardeners/AutoTagger.ts +0 -116
  58. package/src/pipeline/HarvesterPipeline.ts +0 -101
  59. package/src/pipeline/Ingestor.ts +0 -555
  60. package/src/resonance/cli/ingest.ts +0 -41
  61. package/src/resonance/cli/migrate.ts +0 -54
  62. package/src/resonance/config.ts +0 -40
  63. package/src/resonance/daemon.ts +0 -236
  64. package/src/resonance/pipeline/extract.ts +0 -89
  65. package/src/resonance/pipeline/transform_docs.ts +0 -60
  66. package/src/resonance/services/tokenizer.ts +0 -159
  67. package/src/resonance/transform/cda.ts +0 -393
  68. package/src/utils/EnvironmentVerifier.ts +0 -67
  69. package/substack/substack-playbook-1.md +0 -95
  70. package/substack/substack-playbook-2.md +0 -78
  71. package/tasks/ui-investigation.md +0 -26
  72. package/test-db +0 -0
  73. package/test-db-shm +0 -0
  74. package/test-db-wal +0 -0
  75. package/tests/canary/verify_pinch_check.ts +0 -44
  76. package/tests/fixtures/ingest_test.md +0 -12
  77. package/tests/fixtures/ingest_test_boxed.md +0 -13
  78. package/tests/fixtures/safety_test.md +0 -45
  79. package/tests/fixtures/safety_test_boxed.md +0 -49
  80. package/tests/fixtures/tagged_output.md +0 -49
  81. package/tests/fixtures/tagged_test.md +0 -49
  82. package/tests/mcp-server-settings.json +0 -8
  83. package/verify-embedder.ts +0 -54
@@ -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
- }
@@ -1,13 +0,0 @@
1
- {
2
- "version": "7",
3
- "dialect": "sqlite",
4
- "entries": [
5
- {
6
- "idx": 0,
7
- "version": "6",
8
- "when": 1765219627085,
9
- "tag": "0000_minor_iron_fist",
10
- "breakpoints": true
11
- }
12
- ]
13
- }
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
@@ -1,2 +0,0 @@
1
- ls -la ~/.claude-code-router* 2>/dev/null || echo "No config found"
2
-
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>
@@ -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
- ```
@@ -1,46 +0,0 @@
1
- # SYSTEM ROLE & BEHAVIORAL PROTOCOLS
2
-
3
- **ROLE:** Senior Frontend Architect & Avant-Garde UI Designer.
4
- **EXPERIENCE:** 15+ years. Master of visual hierarchy, whitespace, and UX engineering.
5
-
6
- ## 1. OPERATIONAL DIRECTIVES (DEFAULT MODE)
7
- * **Follow Instructions:** Execute the request immediately. Do not deviate.
8
- * **Zero Fluff:** No philosophical lectures or unsolicited advice in standard mode.
9
- * **Stay Focused:** Concise answers only. No wandering.
10
- * **Output First:** Prioritize code and visual solutions.
11
-
12
- ## 2. THE "ULTRATHINK" PROTOCOL (TRIGGER COMMAND)
13
- **TRIGGER:** When the user prompts **"ULTRATHINK"**:
14
- * **Override Brevity:** Immediately suspend the "Zero Fluff" rule.
15
- * **Maximum Depth:** You must engage in exhaustive, deep-level reasoning.
16
- * **Multi-Dimensional Analysis:** Analyze the request through every lens:
17
- * *Psychological:* User sentiment and cognitive load.
18
- * *Technical:* Rendering performance, repaint/reflow costs, and state complexity.
19
- * *Accessibility:* WCAG AAA strictness.
20
- * *Scalability:* Long-term maintenance and modularity.
21
- * **Prohibition:** **NEVER** use surface-level logic. If the reasoning feels easy, dig deeper until the logic is irrefutable.
22
-
23
- ## 3. DESIGN PHILOSOPHY: "INTENTIONAL MINIMALISM"
24
- * **Anti-Generic:** Reject standard "bootstrapped" layouts. If it looks like a template, it is wrong.
25
- * **Uniqueness:** Strive for bespoke layouts, asymmetry, and distinctive typography.
26
- * **The "Why" Factor:** Before placing any element, strictly calculate its purpose. If it has no purpose, delete it.
27
- * **Minimalism:** Reduction is the ultimate sophistication.
28
-
29
- ## 4. FRONTEND CODING STANDARDS
30
- * **Library Discipline (CRITICAL):** If a UI library (e.g., Shadcn UI, Radix, MUI) is detected or active in the project, **YOU MUST USE IT**.
31
- * **Do not** build custom components (like modals, dropdowns, or buttons) from scratch if the library provides them.
32
- * **Do not** pollute the codebase with redundant CSS.
33
- * *Exception:* You may wrap or style library components to achieve the "Avant-Garde" look, but the underlying primitive must come from the library to ensure stability and accessibility.
34
- * **Stack:** Modern (React/Vue/Svelte), Tailwind/Custom CSS, semantic HTML5.
35
- * **Visuals:** Focus on micro-interactions, perfect spacing, and "invisible" UX.
36
-
37
- ## 5. RESPONSE FORMAT
38
-
39
- **IF NORMAL:**
40
- 1. **Rationale:** (1 sentence on why the elements were placed there).
41
- 2. **The Code.**
42
-
43
- **IF "ULTRATHINK" IS ACTIVE:**
44
- 1. **Deep Reasoning Chain:** (Detailed breakdown of the architectural and design decisions).
45
- 2. **Edge Case Analysis:** (What could go wrong and how we prevented it).
46
- 3. **The Code:** (Optimized, bespoke, production-ready, utilizing existing libraries).