amalfa 1.0.2 → 1.0.4

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 (55) hide show
  1. package/package.json +1 -1
  2. package/src/cli.ts +1 -1
  3. package/docs/AGENT-METADATA-PATTERNS.md +0 -1021
  4. package/docs/AGENT_PROTOCOLS.md +0 -28
  5. package/docs/ARCHITECTURAL_OVERVIEW.md +0 -123
  6. package/docs/BENTO_BOXING_DEPRECATION.md +0 -281
  7. package/docs/Bun-SQLite.html +0 -464
  8. package/docs/COMMIT_GUIDELINES.md +0 -367
  9. package/docs/CONFIG_E2E_VALIDATION.md +0 -147
  10. package/docs/CONFIG_UNIFICATION.md +0 -187
  11. package/docs/CONFIG_VALIDATION.md +0 -103
  12. package/docs/DEVELOPER_ONBOARDING.md +0 -36
  13. package/docs/Graph and Vector Database Best Practices.md +0 -214
  14. package/docs/LEGACY_DEPRECATION.md +0 -174
  15. package/docs/MCP_SETUP.md +0 -317
  16. package/docs/PERFORMANCE_BASELINES.md +0 -88
  17. package/docs/QUICK_START_MCP.md +0 -168
  18. package/docs/REPOSITORY_CLEANUP_SUMMARY.md +0 -261
  19. package/docs/SESSION-2026-01-06-METADATA-PATTERNS.md +0 -346
  20. package/docs/SETUP.md +0 -464
  21. package/docs/SETUP_COMPLETE.md +0 -464
  22. package/docs/VISION-AGENT-LEARNING.md +0 -1242
  23. package/docs/_current-config-status.md +0 -93
  24. package/docs/edge-generation-methods.md +0 -57
  25. package/docs/elevator-pitch.md +0 -118
  26. package/docs/graph-and-vector-database-playbook.html +0 -480
  27. package/docs/hardened-sqlite.md +0 -85
  28. package/docs/headless-knowledge-management.md +0 -79
  29. package/docs/john-kaye-flux-prompt.md +0 -46
  30. package/docs/keyboard-shortcuts.md +0 -80
  31. package/docs/opinion-proceed-pattern.md +0 -29
  32. package/docs/polyvis-nodes-edges-schema.md +0 -77
  33. package/docs/protocols/lab-protocol.md +0 -30
  34. package/docs/reaction-iquest-loop-coder.md +0 -46
  35. package/docs/services.md +0 -60
  36. package/docs/sqlite-wal-readonly-trap.md +0 -228
  37. package/docs/strategy/css-architecture.md +0 -40
  38. package/docs/test-document-cycle.md +0 -83
  39. package/docs/test_lifecycle_E2E.md +0 -4
  40. package/docs/the-bicameral-graph.md +0 -83
  41. package/docs/user-guide.md +0 -70
  42. package/docs/vision-helper.md +0 -53
  43. package/polyvis.settings.json.bak +0 -38
  44. package/src/EnlightenedTriad.ts +0 -146
  45. package/src/JIT_Triad.ts +0 -137
  46. package/src/data/experience/test_doc_1.md +0 -2
  47. package/src/data/experience/test_doc_2.md +0 -2
  48. package/src/demo-triad.ts +0 -45
  49. package/src/gardeners/BaseGardener.ts +0 -55
  50. package/src/llm/EnlightenedProvider.ts +0 -95
  51. package/src/services/README.md +0 -56
  52. package/src/services/llama.ts +0 -59
  53. package/src/services/llamauv.ts +0 -56
  54. package/src/services/olmo3.ts +0 -58
  55. package/src/services/phi.ts +0 -52
@@ -1,261 +0,0 @@
1
- # Repository Cleanup Summary
2
-
3
- **Date:** 2026-01-05
4
- **Branch:** alpine-refactor
5
- **Issue:** Repository was tracking 966 files with .git size of 193 MB
6
-
7
- ---
8
-
9
- ## Problem Identified
10
-
11
- The polyvis repository was accumulating artifacts that should not be versioned:
12
-
13
- ### Artifacts Found (40+ MB total)
14
-
15
- 1. **Database Files** (~20 MB)
16
- - `_misc/bento_ledger.sqlite`
17
- - `bento_ledger.sqlite`, `.sqlite-wal`, `.sqlite-shm`
18
- - `canary-persistence.db`
19
- - `test-graph-integrity.db-wal`
20
- - `public/resonance.db.pre-hollow-node` (5.9 MB)
21
-
22
- 2. **Database Backups** (~9 MB)
23
- - `backups/db/resonance.20251214140633.db` (5.9 MB)
24
- - `backups/db/benchmarks/resonance.db.pre-benchmark-20251217-184046` (8.5 MB)
25
- - `backups/db/benchmarks/resonance.db.corrupted-20251217-201947`
26
-
27
- 3. **Large PDFs** (~11 MB)
28
- - `experiments/enlightenment/representational-engineering.pdf` (10 MB)
29
- - `docs/2310.08560v2.pdf` (648 KB)
30
-
31
- 4. **Built Bundles**
32
- - `experiments/data-star-dashboard/dist/datastar.bundle.js` (80 KB)
33
-
34
- ---
35
-
36
- ## Actions Taken
37
-
38
- ### 1. Updated .gitignore
39
-
40
- Added comprehensive patterns to prevent future commits:
41
-
42
- ```gitignore
43
- # Database Files (Generated Artifacts - Never Commit)
44
- *.db
45
- *.db-wal
46
- *.db-shm
47
- *.sqlite
48
- *.sqlite-wal
49
- *.sqlite-shm
50
-
51
- # Database Backups
52
- backups/db/
53
-
54
- # Built/Bundled JavaScript
55
- **/dist/*.bundle.js
56
- **/dist/*.min.js
57
- experiments/**/dist/
58
-
59
- # Test Artifacts
60
- test-*.db
61
- test-*.db-wal
62
- canary-*.db
63
-
64
- # Large Research Papers
65
- *.pdf
66
- !docs/architecture-diagrams/*.pdf
67
- ```
68
-
69
- **Commit:** `0c3015e`
70
-
71
- ### 2. Created Documentation
72
-
73
- **docs/COMMIT_GUIDELINES.md**
74
- - Comprehensive guide on what to/not to commit
75
- - Quick reference checklist
76
- - Edge cases and troubleshooting
77
- - Philosophy: "Repository should contain minimum necessary to build and understand"
78
-
79
- **Key principles:**
80
- - ✅ Source code, configs, documentation, small assets
81
- - ❌ Generated artifacts, large binaries, backups, secrets
82
-
83
- **Commit:** `0c3015e`
84
-
85
- ### 3. Created Cleanup Script
86
-
87
- **scripts/cleanup-repo-artifacts.sh**
88
- - Interactive script to remove artifacts from git history
89
- - Safety checks (prevents running on main branch)
90
- - Creates backup branch before cleanup
91
- - Uses git-filter-repo (preferred) or filter-branch (fallback)
92
- - Aggressive garbage collection
93
-
94
- **Usage:**
95
- ```bash
96
- ./scripts/cleanup-repo-artifacts.sh
97
- ```
98
-
99
- **Commit:** `0c3015e`
100
-
101
- ### 4. Removed Artifacts from Index
102
-
103
- Removed 14 files from git tracking (not history):
104
-
105
- ```bash
106
- git rm --cached -r backups/db/
107
- git rm --cached _misc/bento_ledger.sqlite
108
- git rm --cached bento_ledger.sqlite*
109
- git rm --cached canary-persistence.db
110
- git rm --cached test-graph-integrity.db-wal
111
- git rm --cached public/resonance.db.pre-hollow-node
112
- git rm --cached experiments/enlightenment/representational-engineering.pdf
113
- git rm --cached docs/2310.08560v2.pdf
114
- git rm --cached experiments/data-star-dashboard/dist/datastar.bundle.js
115
- ```
116
-
117
- **Result:** 966 → 954 tracked files
118
-
119
- **Commit:** `0c3015e`
120
-
121
- ---
122
-
123
- ## Current State
124
-
125
- ### Metrics (Post-Cleanup)
126
-
127
- - **Files tracked:** 954 (down from 966)
128
- - **Repository size:** 193 MB (unchanged - files remain in history)
129
- - **Untracked files:** Database files now properly ignored
130
-
131
- ### Why .git Size Unchanged?
132
-
133
- The removed files are still in git history. To fully reclaim space, you need to:
134
-
135
- 1. Run the cleanup script: `./scripts/cleanup-repo-artifacts.sh`
136
- 2. Force push to rewrite remote history
137
- 3. Coordinate with team (they'll need to re-clone or reset)
138
-
139
- **⚠️ Important:** History rewriting is disruptive. Only do this if:
140
- - Working on a feature branch (✅ we're on alpine-refactor)
141
- - Team is coordinated
142
- - No open PRs depend on current history
143
-
144
- ---
145
-
146
- ## Benefits Achieved
147
-
148
- ### Immediate Benefits
149
-
150
- 1. **Prevention:** `.gitignore` now prevents committing artifacts
151
- 2. **Documentation:** Clear guidelines on what to commit
152
- 3. **Tools:** Script ready for full history cleanup
153
- 4. **Current commits:** New work won't add artifacts
154
-
155
- ### Potential Future Benefits (After History Cleanup)
156
-
157
- 1. **Faster operations:** Clone, fetch, push will be quicker
158
- 2. **Smaller repo:** ~40-50 MB reduction estimated
159
- 3. **Cleaner history:** Only source code and docs versioned
160
-
161
- ---
162
-
163
- ## Next Steps (Optional)
164
-
165
- ### Full History Cleanup
166
-
167
- If you want to reclaim the 40+ MB from history:
168
-
169
- ```bash
170
- # 1. Ensure you're on alpine-refactor
171
- git checkout alpine-refactor
172
-
173
- # 2. Run the cleanup script
174
- ./scripts/cleanup-repo-artifacts.sh
175
-
176
- # 3. Force push (after verification)
177
- git push --force origin alpine-refactor
178
-
179
- # 4. Notify team members to reset their branches
180
- ```
181
-
182
- **Team coordination required!**
183
-
184
- ### Maintenance
185
-
186
- **Going forward:**
187
-
188
- 1. Review `.gitignore` patterns regularly
189
- 2. Check commit size before pushing (see COMMIT_GUIDELINES.md)
190
- 3. Run `git ls-files | grep -E '\.(db|sqlite|pdf)$'` periodically
191
- 4. Educate contributors about artifact policies
192
-
193
- ---
194
-
195
- ## Related Files
196
-
197
- - **Guidelines:** `docs/COMMIT_GUIDELINES.md`
198
- - **Cleanup script:** `scripts/cleanup-repo-artifacts.sh`
199
- - **Gitignore:** `.gitignore`
200
- - **Beads playbooks:** `playbooks/beads-{agent,human}-playbook.md`
201
-
202
- ---
203
-
204
- ## Philosophy
205
-
206
- **Core principle:** *Git is for source code, not generated artifacts.*
207
-
208
- **Rationale:**
209
- - Database files are generated from JSON (the source of truth)
210
- - Built bundles are generated from TypeScript source
211
- - Research papers should be linked, not embedded
212
- - Backups belong in backup systems, not version control
213
-
214
- **Goal:** Keep the repository lean, fast, and comprehensible.
215
-
216
- ---
217
-
218
- ## Before/After Comparison
219
-
220
- ### Before
221
-
222
- ```
223
- Files tracked: 966
224
- .git size: 193 MB
225
- Issues: Databases, PDFs, backups committed
226
- Prevention: Weak .gitignore patterns
227
- Documentation: None
228
- ```
229
-
230
- ### After (Current)
231
-
232
- ```
233
- Files tracked: 954
234
- .git size: 193 MB (history unchanged)
235
- Issues: Future commits prevented
236
- Prevention: Comprehensive .gitignore
237
- Documentation: COMMIT_GUIDELINES.md
238
- Tools: cleanup-repo-artifacts.sh
239
- ```
240
-
241
- ### After (If History Cleaned)
242
-
243
- ```
244
- Files tracked: 954
245
- .git size: ~140 MB (estimated)
246
- Issues: Resolved
247
- Prevention: Comprehensive .gitignore
248
- Documentation: COMMIT_GUIDELINES.md
249
- Tools: cleanup-repo-artifacts.sh
250
- ```
251
-
252
- ---
253
-
254
- ## Commits
255
-
256
- - `0c3015e` - Remove artifacts and add commit guidelines
257
- - `aee1d2a` - Add Beads playbooks (includes initial .resonance/cache cleanup)
258
-
259
- ---
260
-
261
- **Conclusion:** Immediate improvements achieved. Full history cleanup optional but recommended for long-term repository health.
@@ -1,346 +0,0 @@
1
- # Session Summary: Agent-First Metadata & Latent Space Tagging
2
-
3
- **Date:** 2026-01-06
4
- **Duration:** ~1 hour
5
- **Topic:** Agent autonomy in metadata generation
6
-
7
- ---
8
-
9
- ## Key Insights
10
-
11
- ### 1. The Inversion: Agent Does, Human Audits
12
-
13
- **Traditional model:**
14
- - Human approves every tag, link, decision
15
- - Bottleneck: O(N) human effort
16
-
17
- **New model:**
18
- - Agent auto-augments everything
19
- - Human audits via git diff (O(log N) effort)
20
- - Human corrects errors when found
21
- - System learns from corrections
22
-
23
- **Result:** Scales without human bottleneck.
24
-
25
- ### 2. Latent Space Tagging
26
-
27
- **Innovation:** Tags emerge from vector clustering, not predefined taxonomy.
28
-
29
- **How it works:**
30
- ```python
31
- # Cluster documents in embedding space
32
- clusters = cluster_embeddings(all_docs, min_size=3)
33
-
34
- # Generate labels from cluster content
35
- for cluster in clusters:
36
- label = generate_label(cluster.documents)
37
- # e.g., "auth-state-patterns"
38
-
39
- # Tag all docs with confidence scores
40
- for doc in cluster.documents:
41
- doc.add_tag(f"latent:{label}", confidence)
42
- ```
43
-
44
- **Advantages:**
45
- - No taxonomy to maintain
46
- - Adapts as corpus grows
47
- - Multi-cluster membership
48
- - Confidence scores expose uncertainty
49
-
50
- ### 3. Git as Safety Net
51
-
52
- **All agent augmentations are git commits:**
53
-
54
- ```bash
55
- # Agent augments
56
- [Amalfa: auto-tagged debrief-auth-refactor]
57
-
58
- # Human reviews
59
- $ git diff
60
-
61
- # Human corrects if needed
62
- $ vim debrief.md # remove incorrect tag
63
- $ git commit -m "Remove incorrect tag"
64
-
65
- # Daemon syncs automatically
66
- [Amalfa: re-indexed, learned from correction]
67
- ```
68
-
69
- **Benefits:**
70
- - Atomic (one commit per augmentation)
71
- - Auditable (see what changed)
72
- - Reversible (revert anytime)
73
- - Non-destructive (history preserved)
74
-
75
- ### 4. Seven Auto-Augmentation Patterns
76
-
77
- 1. **Latent Space Tagging** - Cluster-based organization
78
- 2. **Entity Extraction & Auto-Linking** - Wiki links inserted automatically
79
- 3. **Topic Modeling** - High-level themes (LDA/BERTopic)
80
- 4. **Similarity-Based Suggested Reading** - Context for new sessions
81
- 5. **Temporal Sequences** - Track work evolution
82
- 6. **Semantic Backlinks** - Bidirectional links maintained automatically
83
- 7. **Confidence-Based Tag Weighting** - Express uncertainty, learn from removals
84
-
85
- ---
86
-
87
- ## Documents Created
88
-
89
- ### 1. VISION-AGENT-LEARNING.md
90
-
91
- **Purpose:** Vision document for agent-generated knowledge
92
-
93
- **Key sections:**
94
- - The brief-debrief-playbook flywheel
95
- - Spec-driven vs. learning-driven development
96
- - Human as reader, not writer
97
- - Implications for Amalfa design
98
- - Evolution path (manual → emergent)
99
-
100
- **Size:** ~1200 lines
101
-
102
- **Main insight:** Documentation is cognition, not just artifact. Writing forces reflection.
103
-
104
- ### 2. AGENT-METADATA-PATTERNS.md
105
-
106
- **Purpose:** Design document for auto-augmentation system
107
-
108
- **Key sections:**
109
- - Core principles (agent autonomy, git as truth, optimistic metadata)
110
- - Pattern library (7 patterns with implementations)
111
- - Daemon's role (continuous file watching)
112
- - Human audit workflow
113
- - Configuration & implementation phases
114
-
115
- **Size:** ~1000 lines
116
-
117
- **Main insight:** Metadata is optimistically generated, occasionally corrected (not pessimistically approved upfront).
118
-
119
- ---
120
-
121
- ## Folder Structure
122
-
123
- Amalfa already has the brief-debrief-playbook pattern from PolyVis:
124
-
125
- ```
126
- amalfa/
127
- ├── briefs/
128
- │ ├── pending/ # Active work
129
- │ ├── holding/ # Deferred work
130
- │ ├── archive/ # Completed work
131
- │ └── README.md # Workflow guide
132
-
133
- ├── debriefs/ # ~100+ dated debriefs
134
- │ ├── 2025-01-03-embedder-refactor.md
135
- │ ├── 2025-01-02-...md
136
- │ └── README.md # Debrief guide
137
-
138
- ├── playbooks/ # ~30+ domain playbooks
139
- │ ├── alpinejs-playbook.md
140
- │ ├── embeddings-and-fafcas-protocol-playbook.md
141
- │ ├── local-first-vector-db-playbook.md
142
- │ ├── problem-solving-playbook.md
143
- │ └── README.md # Playbook index
144
-
145
- └── docs/
146
- ├── VISION-AGENT-LEARNING.md
147
- ├── AGENT-METADATA-PATTERNS.md
148
- └── SETUP.md
149
- ```
150
-
151
- **Status:** Infrastructure already in place, ready for Amalfa enhancement.
152
-
153
- ---
154
-
155
- ## The Auto-Augmentation Workflow
156
-
157
- ### Phase 1: Agent Writes
158
-
159
- ```markdown
160
- # Debrief: Auth Refactor
161
-
162
- ## What Worked
163
- - Alpine's x-data pattern eliminated manual state tracking
164
-
165
- ## Lessons Learned
166
- - Alpine for UI state, localStorage for persistence
167
- ```
168
-
169
- ### Phase 2: Agent Saves → Auto-Augmentation
170
-
171
- ```bash
172
- $ amalfa auto-augment debrief-auth-refactor.md
173
-
174
- Processing...
175
- ✓ Entity extraction (found: Alpine, x-data, localStorage)
176
- ✓ Auto-linking (3 links inserted)
177
- ✓ Clustering (auth-state-patterns, 0.91)
178
- ✓ Similarity search (5 neighbors)
179
- ✓ Tag extraction (6 tags)
180
- ✓ Metadata generation
181
-
182
- [Amalfa: auto-tagged debrief-auth-refactor]
183
- ```
184
-
185
- ### Phase 3: Result
186
-
187
- ```markdown
188
- ---
189
- type: debrief
190
- brief_id: brief-auth-refactor
191
-
192
- # Auto-generated by Amalfa (edit freely)
193
- tags:
194
- explicit: [alpine.js, state-management, localStorage]
195
- latent:
196
- - auth-state-patterns (0.91)
197
- - ui-reactivity (0.78)
198
-
199
- links:
200
- - playbook-alpine-patterns (uses-pattern, 0.89)
201
- - debrief-session-management (similar-problem, 0.87)
202
-
203
- suggested_reading:
204
- - debrief-session-management (0.87)
205
- - playbook-state-patterns (0.82)
206
- ---
207
-
208
- # Debrief: Auth Refactor
209
-
210
- ## What Worked
211
- - [[playbook-alpine-patterns|Alpine's x-data pattern]] eliminated state tracking
212
- ...
213
- ```
214
-
215
- ### Phase 4: Human Audits (Weekly)
216
-
217
- ```bash
218
- $ git log --since="1 week ago" --grep="Amalfa:" --oneline
219
-
220
- a7f3d2e Amalfa: auto-tagged debrief-auth-refactor
221
- 8b2e4f1 Amalfa: re-clustered corpus (15 new docs)
222
-
223
- # Review, correct if needed
224
- $ vim debrief-auth-refactor.md # remove incorrect tag
225
- $ git commit -m "Remove incorrect tag"
226
-
227
- # Daemon learns from correction
228
- ```
229
-
230
- ---
231
-
232
- ## Implementation Phases
233
-
234
- ### Phase 1: Basic Auto-Augmentation (MVP)
235
- - Entity extraction
236
- - Auto-linking (high similarity)
237
- - Tag extraction
238
- - Embedding generation
239
- - Git commits
240
-
241
- **Result:** Agent writes → tags + links added automatically
242
-
243
- ### Phase 2: Latent Space Tagging
244
- - Document clustering
245
- - Auto-generated cluster labels
246
- - Confidence scores
247
- - Topic modeling
248
- - Re-clustering trigger
249
-
250
- **Result:** Documents self-organize without predefined taxonomy
251
-
252
- ### Phase 3: Semantic Relationships
253
- - K-nearest neighbors
254
- - Suggested reading
255
- - Temporal sequences
256
- - Backlink maintenance
257
-
258
- **Result:** Agents get context quickly on new sessions
259
-
260
- ### Phase 4: Learning from Corrections
261
- - Track human edits
262
- - Adjust confidence thresholds
263
- - Improve extraction
264
- - Weekly digest
265
-
266
- **Result:** System improves over time
267
-
268
- ---
269
-
270
- ## Success Metrics
271
-
272
- ### Agent Productivity
273
-
274
- **Before:** 25 minutes (write 15m + tag 5m + link 5m)
275
- **After:** 15 minutes (write 15m + auto-augment 2s)
276
- **Gain:** 40% faster
277
-
278
- ### Human Audit Overhead
279
-
280
- **Target:** O(log N)
281
-
282
- - 10 docs: 5 min weekly
283
- - 100 docs: 15 min weekly
284
- - 1000 docs: 30 min weekly
285
-
286
- **Corrections needed:** <5% of augmentations
287
-
288
- ### Knowledge Discovery
289
-
290
- **Before:** 40 minutes (scan titles + read 5-10 docs)
291
- **After:** 10 minutes (semantic search 5s + read top 3)
292
- **Gain:** 75% faster
293
-
294
- ---
295
-
296
- ## Key Quotes
297
-
298
- > "The main benefit from the tags and links is for the agent coming in to a new session and getting up to speed easily and quickly - so the more the agent can do the better."
299
-
300
- > "If the human finds anything they object to they can remove or modify it - the daemon will pick up the changes and the ingestion will handle it as usual."
301
-
302
- > "What you should do is provide a set of patterns the agent can use, EG a latent space tag system."
303
-
304
- ---
305
-
306
- ## Next Steps
307
-
308
- 1. **Review existing briefs/debriefs/playbooks** - Understand current patterns
309
- 2. **Design Amalfa schema** - Support brief-debrief-playbook types
310
- 3. **Implement Phase 1** - Basic auto-augmentation (MVP)
311
- 4. **Test on Amalfa corpus** - Use existing debriefs as test data
312
- 5. **Iterate based on experience** - Learn from PolyVis migration
313
-
314
- ---
315
-
316
- ## Related Documents
317
-
318
- - `VISION-AGENT-LEARNING.md` - Why agent-generated knowledge works
319
- - `AGENT-METADATA-PATTERNS.md` - How to implement auto-augmentation
320
- - `SETUP.md` - NPM/GitHub setup for publishing Amalfa
321
- - `briefs/README.md` - Brief workflow guide
322
- - `debriefs/README.md` - Debrief workflow guide
323
- - `playbooks/README.md` - Playbook evolution guide
324
-
325
- ---
326
-
327
- ## Conversation Context
328
-
329
- This session built on:
330
- - Previous discussion: Agents using Amalfa for cross-session continuity
331
- - PolyVis experience: Brief-debrief-playbook pattern proved effective
332
- - Meta-insight: Agents spontaneously maintained docs without prompting
333
-
334
- **The leap:** If agents naturally maintain docs when given structure, and Amalfa provides semantic infrastructure, then agents can achieve true cross-session continuity with minimal human overhead.
335
-
336
- **The mechanism:** Latent space tagging + git-based auditing = agent autonomy at scale.
337
-
338
- ---
339
-
340
- **Status:** Vision and design documents complete
341
- **Next:** Implementation planning and MVP development
342
- **Timeline:** Phases 1-2 achievable in weeks, not months
343
-
344
- ---
345
-
346
- _Documentation is not an artifact of work - it's a cognitive tool. Auto-augmentation scales this tool to agent speed._