amalfa 1.4.3 → 1.5.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/CHANGELOG.md +64 -0
- package/README.md +287 -140
- package/package.json +13 -5
- package/src/cli/commands/explore.ts +153 -0
- package/src/cli/commands/find-gaps.ts +122 -0
- package/src/cli/commands/inject-tags.ts +133 -0
- package/src/cli/commands/list-sources.ts +36 -0
- package/src/cli/commands/read.ts +116 -0
- package/src/cli/commands/search.ts +167 -0
- package/src/cli/commands/services.ts +2 -2
- package/src/cli/commands/setup-python.ts +54 -0
- package/src/cli.ts +52 -4
- package/src/core/GraphGardener.ts +7 -1
- package/src/daemon/index.ts +2 -4
- package/src/ember/analyzer.ts +62 -6
- package/src/ember/index.ts +4 -1
- package/src/mcp/index.ts +40 -14
- package/src/pipeline/AmalfaIngestor.ts +121 -6
- package/src/services/LangExtractClient.ts +136 -0
- package/src/services/reranker-hf.ts +129 -0
- package/src/sidecars/lang-extract/.python-version +1 -0
- package/src/sidecars/lang-extract/README.md +22 -0
- package/src/sidecars/lang-extract/main.py +6 -0
- package/src/sidecars/lang-extract/pyproject.toml +10 -0
- package/src/sidecars/lang-extract/server.py +72 -0
- package/src/sidecars/lang-extract/uv.lock +988 -0
- package/src/utils/Logger.ts +1 -0
- package/src/utils/projectRoot.ts +110 -0
- package/src/utils/reranker-client.ts +146 -0
- package/tsconfig.json +3 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,70 @@ All notable changes to AMALFA will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [1.5.0] - 2026-01-26
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
- **LangExtract Sidecar**: Integrated Python-based entity extraction via MCP/Stdio bridge.
|
|
12
|
+
- New robust Node.js client (`src/services/LangExtractClient.ts`) with Zod validation and Pino logging.
|
|
13
|
+
- Automatically enriches documents >200 chars during `amalfa ember scan`.
|
|
14
|
+
- Handles API rate limits (429) gracefully.
|
|
15
|
+
- **Reranker Integration**: Finalized BGE-M3 cross-encoder support.
|
|
16
|
+
- Added `--rerank` flag to `amalfa search` CLI command.
|
|
17
|
+
- Integrated `ContentHydrator` for retrieving document content for reranking.
|
|
18
|
+
- Verified end-to-end quality improvement.
|
|
19
|
+
- **Example Config**: Added `amalfa.config.example.json` reference file.
|
|
20
|
+
|
|
21
|
+
### Changed
|
|
22
|
+
- **Service Naming**: Renamed `amalfa daemon` to `amalfa watcher` to align with internal naming and reduce confusion.
|
|
23
|
+
- `amalfa daemon` is now deprecated but still works (with warning).
|
|
24
|
+
- Updated `package.json` scripts to use `watcher`.
|
|
25
|
+
- **Ember Hardening**: Fixed critical bug in tag parsing logic that caused garbage tags (single characters).
|
|
26
|
+
- Implemented strict array checking for tags.
|
|
27
|
+
- Added hygiene filters to remove numeric-only and short tags.
|
|
28
|
+
- Updated `EmberAnalyzer` to use project-relative paths for portable sidecars.
|
|
29
|
+
|
|
30
|
+
### Fixed
|
|
31
|
+
- **Tag Corruption**: Identified and fixed corrupted metadata in documentation files (`newbie-onboarding.md`, etc.) caused by previous buggy runs.
|
|
32
|
+
- **Git Hygiene**: Added `*.ember.json` to `.gitignore` to treat sidecars as ephemeral artifacts.
|
|
33
|
+
|
|
34
|
+
## [1.4.4] - 2026-01-17
|
|
35
|
+
### Added
|
|
36
|
+
- **Consistency Audit System**: Automated consistency checker for documentation/code alignment
|
|
37
|
+
- 6 check categories: CLI commands, file paths, service naming, config schema, cross-references, legacy commands
|
|
38
|
+
- Integrated into precommit hook with 80% threshold
|
|
39
|
+
- JSON output for dashboard integration
|
|
40
|
+
- Command: `bun run consistency-report`
|
|
41
|
+
|
|
42
|
+
### Improved
|
|
43
|
+
- **MCP Tool Descriptions**: Enhanced all 8 tool descriptions with strategic guidance
|
|
44
|
+
- When to use each tool (search_documents, explore_links, find_gaps, etc.)
|
|
45
|
+
- Value proposition and trigger scenarios
|
|
46
|
+
- Better agent understanding of tool purpose
|
|
47
|
+
- **User Prompting Guide**: Added comprehensive section to README.md
|
|
48
|
+
- Effective prompts during and after work
|
|
49
|
+
- Building institutional memory patterns
|
|
50
|
+
- When NOT to prompt (novel problems, fresh thinking)
|
|
51
|
+
- **Agent Developer Documentation**: New 113-line section in MCP-TOOLS.md
|
|
52
|
+
- Strategic tool usage patterns
|
|
53
|
+
- When to encourage debriefs and playbooks
|
|
54
|
+
- Proactive vs reactive search patterns
|
|
55
|
+
- TypeScript integration examples
|
|
56
|
+
|
|
57
|
+
### Documentation
|
|
58
|
+
- **Fixed Consistency Issues**: Improved from 76% to 98% consistency score
|
|
59
|
+
- Documented all CLI commands (validate, enhance, scripts, kill alias)
|
|
60
|
+
- Fixed daemon file path references in ARCHITECTURE.md
|
|
61
|
+
- Replaced legacy `rm -rf .amalfa/` with staged recovery approach
|
|
62
|
+
- Created `amalfa.config.example.json`
|
|
63
|
+
- Updated all legacy command references
|
|
64
|
+
|
|
65
|
+
### Developer Experience
|
|
66
|
+
- **Precommit Hook Enhancement**: Now includes 4 checks
|
|
67
|
+
- TypeScript compilation
|
|
68
|
+
- Biome lint/format
|
|
69
|
+
- **NEW:** Consistency audit (80% threshold)
|
|
70
|
+
- Changelog verification
|
|
71
|
+
|
|
8
72
|
## [1.4.3] - 2026-01-16
|
|
9
73
|
### Documentation
|
|
10
74
|
- Bump to 1.4.3
|
package/README.md
CHANGED
|
@@ -2,181 +2,249 @@
|
|
|
2
2
|
|
|
3
3
|
**A Memory Layer For Agents**
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
[](https://www.npmjs.com/package/amalfa)
|
|
6
|
+
[](https://www.npmjs.com/package/amalfa)
|
|
6
7
|
|
|
7
|
-
|
|
8
|
+
Give your AI agents persistent memory and semantic search across sessions.
|
|
8
9
|
|
|
9
10
|
---
|
|
10
11
|
|
|
12
|
+
## What It Does
|
|
11
13
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
+
**Without Amalfa:**
|
|
15
|
+
- Agents forget context between conversations
|
|
16
|
+
- Same research repeated every session
|
|
17
|
+
- No institutional memory
|
|
18
|
+
- Knowledge resets constantly
|
|
19
|
+
|
|
20
|
+
**With Amalfa:**
|
|
21
|
+
- Agents query past work: "What did we learn about auth?"
|
|
22
|
+
- Semantic search across all documentation
|
|
23
|
+
- Persistent memory through structured reflection (briefs → debriefs → playbooks)
|
|
24
|
+
- Knowledge compounds over time
|
|
25
|
+
|
|
26
|
+
**How it works:** You write markdown. Amalfa indexes it into a searchable knowledge graph. AI agents access it via Model Context Protocol (MCP).
|
|
14
27
|
|
|
15
28
|
---
|
|
16
29
|
|
|
17
|
-
## What
|
|
30
|
+
## What Agents Can Do
|
|
18
31
|
|
|
19
|
-
|
|
32
|
+
Via MCP, agents get 8 tools:
|
|
20
33
|
|
|
21
|
-
-
|
|
22
|
-
-
|
|
23
|
-
-
|
|
24
|
-
-
|
|
25
|
-
-
|
|
34
|
+
- **search_documents(query)** - Semantic search across all markdown
|
|
35
|
+
- **read_node_content(id)** - Read full document content
|
|
36
|
+
- **explore_links(id)** - Traverse document relationships
|
|
37
|
+
- **find_gaps()** - Discover similar but unlinked documents
|
|
38
|
+
- **list_directory_structure()** - Show document organization
|
|
39
|
+
- **inject_tags(path, tags)** - Add metadata to documents
|
|
40
|
+
- **scratchpad_read/list()** - Cache management for large outputs
|
|
26
41
|
|
|
27
|
-
|
|
42
|
+
**Example Session:**
|
|
43
|
+
```
|
|
44
|
+
Agent: "What did we learn about database migrations?"
|
|
45
|
+
→ search_documents("database migrations lessons")
|
|
46
|
+
→ Returns ranked debriefs with past learnings
|
|
47
|
+
→ Agent applies proven patterns to new work
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
**Performance:** Sub-second searches across 1000+ documents. 4.6x faster than grep. 95% search precision.
|
|
28
51
|
|
|
29
|
-
|
|
52
|
+
👉 **Full Tool Reference:** [MCP Tools Documentation](docs/MCP-TOOLS.md)
|
|
30
53
|
|
|
31
54
|
---
|
|
32
55
|
|
|
33
|
-
##
|
|
56
|
+
## CLI Mode: Direct Command Line Access
|
|
34
57
|
|
|
35
|
-
**
|
|
58
|
+
**Amalfa doesn't require running as an MCP server.** All core search capabilities are available directly from the command line:
|
|
36
59
|
|
|
37
|
-
|
|
60
|
+
### Search Commands
|
|
38
61
|
|
|
39
|
-
|
|
62
|
+
```bash
|
|
63
|
+
# Semantic search across knowledge graph
|
|
64
|
+
amalfa search "oauth patterns" --limit 10
|
|
40
65
|
|
|
41
|
-
|
|
66
|
+
# Read full document content
|
|
67
|
+
amalfa read docs/auth-guide.md
|
|
42
68
|
|
|
43
|
-
|
|
69
|
+
# Explore document relationships
|
|
70
|
+
amalfa explore docs/auth-guide.md --relation references
|
|
44
71
|
|
|
45
|
-
|
|
72
|
+
# List configured source directories
|
|
73
|
+
amalfa list-sources
|
|
46
74
|
|
|
47
|
-
|
|
75
|
+
# Discover similar but unlinked documents (requires Sonar)
|
|
76
|
+
amalfa find-gaps --limit 5 --threshold 0.7
|
|
48
77
|
|
|
49
|
-
|
|
78
|
+
# Add metadata tags to documents
|
|
79
|
+
amalfa inject-tags docs/auth.md "authentication" "security"
|
|
80
|
+
```
|
|
50
81
|
|
|
51
|
-
|
|
82
|
+
### JSON Output for Scripting
|
|
52
83
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
84
|
+
All commands support `--json` for programmatic use:
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
# Machine-readable output
|
|
88
|
+
amalfa search "database migrations" --json | jq '.[0].id'
|
|
89
|
+
|
|
90
|
+
# Chain commands
|
|
91
|
+
amalfa search "auth" --json | jq '.[0].id' | xargs amalfa read
|
|
92
|
+
|
|
93
|
+
# Integrate with CI/CD
|
|
94
|
+
amalfa find-gaps --json | jq 'length' # Count unlinked documents
|
|
63
95
|
```
|
|
64
96
|
|
|
65
|
-
|
|
97
|
+
### When to Use CLI vs MCP
|
|
66
98
|
|
|
67
|
-
|
|
68
|
-
-
|
|
69
|
-
-
|
|
99
|
+
**Use CLI when:**
|
|
100
|
+
- Testing queries without MCP overhead
|
|
101
|
+
- Scripting and automation (CI/CD, shell scripts)
|
|
102
|
+
- Human power users who prefer terminal
|
|
103
|
+
- Agents that execute shell commands (vs MCP protocol)
|
|
104
|
+
- One-shot queries (no server needed)
|
|
70
105
|
|
|
71
|
-
|
|
106
|
+
**Use MCP when:**
|
|
107
|
+
- Integrated with Claude Desktop or other MCP clients
|
|
108
|
+
- Multi-turn agent conversations
|
|
109
|
+
- Need scratchpad caching (MCP-only feature)
|
|
110
|
+
- Prefer agent-native tool calling
|
|
72
111
|
|
|
73
|
-
|
|
74
|
-
- ✅ **No Migration Hell**: Upgrading? Just re-ingest. No migration scripts.
|
|
75
|
-
- ✅ **Deterministic Rebuilds**: Same documents → same database state
|
|
76
|
-
- ✅ **Version Freedom**: Switch between AMALFA versions without fear
|
|
77
|
-
- ✅ **Corruption Immunity**: Database corrupt? Delete and rebuild in seconds
|
|
78
|
-
- ✅ **Model Flexibility**: Change embedding models by re-ingesting
|
|
112
|
+
---
|
|
79
113
|
|
|
80
|
-
|
|
114
|
+
## Prompting Your Agent to Use Amalfa
|
|
81
115
|
|
|
82
|
-
|
|
116
|
+
**Amalfa works best when you establish a knowledge-building habit with your agent.**
|
|
83
117
|
|
|
84
|
-
|
|
118
|
+
### Effective Prompts
|
|
85
119
|
|
|
86
|
-
|
|
120
|
+
**During work:**
|
|
121
|
+
- "What have we learned about [topic]?" → Triggers `search_documents`
|
|
122
|
+
- "Check if we've solved this before" → Searches past solutions
|
|
123
|
+
- "What patterns did we discover?" → Queries playbooks
|
|
87
124
|
|
|
125
|
+
**After work:**
|
|
126
|
+
- "Write a debrief of what we learned" → Encourages documentation
|
|
127
|
+
- "Update the playbook with this pattern" → Codifies knowledge
|
|
128
|
+
- "What related work should be linked?" → Triggers `find_gaps`
|
|
88
129
|
|
|
89
|
-
###
|
|
130
|
+
### Building Institutional Memory
|
|
90
131
|
|
|
132
|
+
**Session start:**
|
|
91
133
|
```
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
↓
|
|
96
|
-
Debrief (what we learned)
|
|
97
|
-
↓
|
|
98
|
-
Playbook (codified patterns)
|
|
99
|
-
↓
|
|
100
|
-
Future briefs (informed by playbooks)
|
|
134
|
+
You: "Before we start, search for any past work on [topic]"
|
|
135
|
+
Agent: [Uses search_documents to query knowledge graph]
|
|
136
|
+
Agent: "Found 3 relevant debriefs from previous sessions..."
|
|
101
137
|
```
|
|
102
138
|
|
|
103
|
-
**
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
- Principles (how we do things)
|
|
110
|
-
- Patterns (reusable solutions)
|
|
111
|
-
- Anti-patterns (what to avoid)
|
|
112
|
-
- Decision records (why we chose X over Y)
|
|
139
|
+
**During problem-solving:**
|
|
140
|
+
```
|
|
141
|
+
You: "Have we encountered this error before?"
|
|
142
|
+
Agent: [Searches past debugging sessions]
|
|
143
|
+
Agent: "Yes, in debrief-auth-safari we learned..."
|
|
144
|
+
```
|
|
113
145
|
|
|
114
|
-
|
|
146
|
+
**Session end:**
|
|
147
|
+
```
|
|
148
|
+
You: "Write a debrief capturing what we learned"
|
|
149
|
+
Agent: [Creates debrief in markdown]
|
|
150
|
+
You: "Now ingest it: amalfa init"
|
|
151
|
+
```
|
|
115
152
|
|
|
116
|
-
|
|
153
|
+
### When NOT to Prompt
|
|
117
154
|
|
|
118
|
-
|
|
119
|
-
-
|
|
120
|
-
-
|
|
121
|
-
-
|
|
155
|
+
**Let agents decide when:**
|
|
156
|
+
- They're working on completely novel problems
|
|
157
|
+
- Quick one-off tasks that won't recur
|
|
158
|
+
- You explicitly want fresh thinking without past bias
|
|
122
159
|
|
|
123
|
-
**
|
|
160
|
+
**The goal:** Build compounding knowledge, not create busywork.
|
|
124
161
|
|
|
125
162
|
---
|
|
126
163
|
|
|
127
|
-
##
|
|
164
|
+
## The Problem
|
|
128
165
|
|
|
129
|
-
|
|
166
|
+
**Scenario:** You're debugging authentication for the 3rd time.
|
|
130
167
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
168
|
+
**Without Amalfa:**
|
|
169
|
+
- Agent searches codebase from scratch
|
|
170
|
+
- Rediscovers same issues
|
|
171
|
+
- Repeats same solutions
|
|
172
|
+
- Context resets every conversation
|
|
173
|
+
|
|
174
|
+
**With Amalfa:**
|
|
175
|
+
```
|
|
176
|
+
Agent queries: "past auth debugging sessions"
|
|
177
|
+
→ Finds debrief from 2 weeks ago
|
|
178
|
+
→ "We learned the token refresh fails in Safari due to cookie scope"
|
|
179
|
+
→ Applies fix immediately
|
|
180
|
+
```
|
|
134
181
|
|
|
135
|
-
|
|
182
|
+
**Result:** 10-minute fix instead of 2-hour investigation.
|
|
136
183
|
|
|
184
|
+
👉 **Deep Dive:** [Why Structured Reflection Beats Infinite Context](docs/WHY-STRUCTURED-REFLECTION.md)
|
|
137
185
|
|
|
138
186
|
---
|
|
139
187
|
|
|
140
|
-
##
|
|
188
|
+
## Core Philosophy: Markdown as Source of Truth
|
|
189
|
+
|
|
190
|
+
**The Inversion:** Traditional systems treat databases as truth and files as exports. Amalfa inverts this.
|
|
191
|
+
|
|
192
|
+
```
|
|
193
|
+
Markdown Files (filesystem) ← Source of truth
|
|
194
|
+
↓
|
|
195
|
+
Ingestion Pipeline
|
|
196
|
+
↓
|
|
197
|
+
SQLite Database (.amalfa/) ← Disposable cache
|
|
198
|
+
↓
|
|
199
|
+
MCP Server → AI Agents
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
**Key principle:** The database can be deleted and regenerated anytime without data loss.
|
|
141
203
|
|
|
142
|
-
###
|
|
204
|
+
### Why This Matters
|
|
205
|
+
|
|
206
|
+
✅ **Zero migration hell** - Upgrade by re-ingesting. No migration scripts.
|
|
207
|
+
✅ **Model flexibility** - Change embedding models without data loss.
|
|
208
|
+
✅ **Corruption immunity** - `rm .amalfa/resonance.db* && amalfa init` fixes everything.
|
|
209
|
+
✅ **Git-native** - Version control your knowledge, not your indexes.
|
|
210
|
+
✅ **Deterministic** - Same markdown → same database state.
|
|
211
|
+
|
|
212
|
+
### Maintenance
|
|
143
213
|
|
|
144
|
-
|
|
145
|
-
-
|
|
146
|
-
-
|
|
147
|
-
- **Reranking:** Xenova Transformers (`bge-reranker-base`)
|
|
148
|
-
- **Protocol:** Model Context Protocol (MCP)
|
|
214
|
+
**Two commands:**
|
|
215
|
+
- `amalfa init` - Regenerate database from markdown (safe, fast)
|
|
216
|
+
- `amalfa doctor` - Health check (rarely needed)
|
|
149
217
|
|
|
150
|
-
|
|
218
|
+
**No migrations. No backups. No complex maintenance.**
|
|
151
219
|
|
|
220
|
+
When something breaks: delete `.amalfa/` and re-ingest. Takes seconds, not hours.
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
---
|
|
224
|
+
|
|
225
|
+
## Architecture
|
|
226
|
+
|
|
227
|
+
**Technology Stack:**
|
|
228
|
+
- Bun (TypeScript runtime)
|
|
229
|
+
- SQLite (local-first database)
|
|
230
|
+
- FastEmbed (bge-small-en-v1.5, 384-dim vectors)
|
|
231
|
+
- Model Context Protocol (MCP)
|
|
232
|
+
|
|
233
|
+
**Data Flow:**
|
|
152
234
|
```
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
│ └── utils/ # Logging, validation, lifecycle
|
|
159
|
-
├── scripts/
|
|
160
|
-
│ ├── cli/ # Command-line tools
|
|
161
|
-
│ └── pipeline/ # Data ingestion pipeline
|
|
162
|
-
├── docs/
|
|
163
|
-
│ ├── VISION-AGENT-LEARNING.md # Core vision
|
|
164
|
-
│ ├── AGENT-METADATA-PATTERNS.md # Auto-augmentation design
|
|
165
|
-
│ └── SETUP.md # NPM publishing guide
|
|
166
|
-
├── briefs/ # Task specifications
|
|
167
|
-
├── debriefs/ # Reflective documents
|
|
168
|
-
└── playbooks/ # Codified patterns
|
|
235
|
+
Markdown → Parser → [Nodes + Edges] → SQLite
|
|
236
|
+
↓
|
|
237
|
+
Vector Embeddings (FAFCAS normalized)
|
|
238
|
+
↓
|
|
239
|
+
Semantic Search → MCP Tools → Agents
|
|
169
240
|
```
|
|
170
241
|
|
|
171
|
-
|
|
242
|
+
**Key Designs:**
|
|
243
|
+
- **Hollow Nodes:** Metadata in SQLite, content on filesystem (git-friendly)
|
|
244
|
+
- **FAFCAS Protocol:** Normalized vectors enable 10x faster similarity search
|
|
245
|
+
- **Service Daemons:** Background file watching, vector generation, reranking
|
|
172
246
|
|
|
173
|
-
|
|
174
|
-
2. **FAFCAS Protocol:** Embedding normalization that enables scalar product searches (10x faster than cosine similarity)
|
|
175
|
-
3. **Micro-Daemon Mesh:**
|
|
176
|
-
* **Vector Daemon (3010)**: Embeddings
|
|
177
|
-
* **Reranker Daemon (3011)**: Relevance Scoring
|
|
178
|
-
* **Sonar Agent (3012)**: Reasoning loop
|
|
179
|
-
4. **ServiceLifecycle:** Unified daemon management pattern
|
|
247
|
+
👉 **Deep Dive:** [Architecture Documentation](docs/ARCHITECTURE.md)
|
|
180
248
|
|
|
181
249
|
## Quick Start
|
|
182
250
|
|
|
@@ -188,18 +256,83 @@ amalfa/
|
|
|
188
256
|
bun install -g amalfa
|
|
189
257
|
```
|
|
190
258
|
|
|
259
|
+
**IMPORTANT**: Amalfa must be installed via **Bun only**. Do not use npm or other package managers.
|
|
260
|
+
|
|
191
261
|
**Why Bun?**
|
|
192
262
|
- ⚡ **Fast startup** - Critical for stdio-based MCP servers that spawn on every request
|
|
193
263
|
- 🔄 **Built-in daemon management** - Runs background processes for file watching and vector embeddings
|
|
194
264
|
- 📦 **Native TypeScript** - No compilation step, direct execution from source
|
|
195
265
|
- 🎯 **SQLite performance** - Optimized native bindings for database operations
|
|
196
266
|
|
|
267
|
+
### Uninstalling
|
|
268
|
+
|
|
269
|
+
```bash
|
|
270
|
+
bun remove -g amalfa
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
**Note**: Bun and npm maintain separate package registries. If you accidentally tried `npm install -g amalfa`, it won't work. Always use Bun for Amalfa installation and removal.
|
|
274
|
+
|
|
197
275
|
**From source** (for development):
|
|
198
276
|
```bash
|
|
199
277
|
git clone https://github.com/pjsvis/amalfa.git
|
|
200
278
|
cd amalfa
|
|
201
|
-
bun install
|
|
279
|
+
bun install # Must use bun, not npm
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
### Common Gotchas
|
|
283
|
+
|
|
284
|
+
#### "I can't uninstall amalfa"
|
|
285
|
+
|
|
286
|
+
**Problem**: `npm uninstall -g amalfa` does nothing.
|
|
287
|
+
|
|
288
|
+
**Cause**: Bun and npm are **separate package managers** with separate:
|
|
289
|
+
- Installation directories (`~/.bun/bin/` vs `/usr/local/lib/node_modules/`)
|
|
290
|
+
- Package databases
|
|
291
|
+
- Binary locations
|
|
292
|
+
|
|
293
|
+
Think of them as **crossed porpoises**—two systems swimming in opposite directions, each functional in its own ecosystem, but never coordinating.
|
|
294
|
+
|
|
295
|
+
**Solution**: Use the same package manager you installed with:
|
|
296
|
+
```bash
|
|
297
|
+
# If installed with Bun (correct)
|
|
298
|
+
bun remove -g amalfa
|
|
299
|
+
|
|
300
|
+
# If you somehow have a stale npm install
|
|
301
|
+
npm uninstall -g amalfa
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
**Check which is active**:
|
|
305
|
+
```bash
|
|
306
|
+
which amalfa
|
|
307
|
+
# ~/.bun/bin/amalfa = Bun install ✓
|
|
308
|
+
# /usr/local/bin/amalfa = npm install (wrong)
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
#### "amalfa command not found after install"
|
|
312
|
+
|
|
313
|
+
**Problem**: Shell can't find the `amalfa` binary.
|
|
314
|
+
|
|
315
|
+
**Cause**: `~/.bun/bin` not in your `$PATH`.
|
|
316
|
+
|
|
317
|
+
**Solution**: Add to your shell profile (`~/.zshrc` or `~/.bashrc`):
|
|
318
|
+
```bash
|
|
319
|
+
export PATH="$HOME/.bun/bin:$PATH"
|
|
202
320
|
```
|
|
321
|
+
Then reload: `source ~/.zshrc`
|
|
322
|
+
|
|
323
|
+
#### "Why can't I use npm? It's on npmjs.org"
|
|
324
|
+
|
|
325
|
+
**Answer**: Amalfa is **published** to npm (for discoverability) but **requires Bun to run**. This is because:
|
|
326
|
+
- Bun's native TypeScript execution (no build step)
|
|
327
|
+
- Optimized SQLite bindings
|
|
328
|
+
- Daemon lifecycle management
|
|
329
|
+
- Faster stdio transport for MCP
|
|
330
|
+
|
|
331
|
+
Think of it like a Rust crate that's listed but requires `cargo` to build. npm and Bun are crossed porpoises—both legitimate package managers, but trying to use one to manage the other's installations leads nowhere.
|
|
332
|
+
|
|
333
|
+
#### "trustedDependencies in package.json?"
|
|
334
|
+
|
|
335
|
+
These packages (`onnxruntime-node`, `protobufjs`) run native build scripts during `bun install`. Bun blocks untrusted scripts by default. This whitelist lets them compile native bindings for ML operations.
|
|
203
336
|
|
|
204
337
|
### Setup MCP Server
|
|
205
338
|
|
|
@@ -213,7 +346,7 @@ bun install
|
|
|
213
346
|
|
|
214
347
|
2. **Ingest your markdown**:
|
|
215
348
|
```bash
|
|
216
|
-
|
|
349
|
+
amalfa init
|
|
217
350
|
```
|
|
218
351
|
|
|
219
352
|
3. **Generate MCP config**:
|
|
@@ -255,7 +388,7 @@ bun install
|
|
|
255
388
|
- [ ] Auto-linking (wiki-style [[links]])
|
|
256
389
|
- [ ] Tag extraction and indexing
|
|
257
390
|
- [ ] Git-based auditing for augmentations
|
|
258
|
-
- [
|
|
391
|
+
- [x] Automated file watcher updates
|
|
259
392
|
|
|
260
393
|
### 🚧 Phase 2: Ember Service (Automated Enrichment)
|
|
261
394
|
- ✅ **Analyzer** - Louvain community detection & heuristics
|
|
@@ -293,10 +426,11 @@ bun install
|
|
|
293
426
|
|
|
294
427
|
### Prerequisites
|
|
295
428
|
|
|
296
|
-
- **Bun:** v1.0+ (required)
|
|
297
|
-
- **Node:** v22.x (for compatibility)
|
|
429
|
+
- **Bun:** v1.0+ (required - cannot use npm/yarn/pnpm)
|
|
298
430
|
- **Git:** For version control
|
|
299
431
|
|
|
432
|
+
**Note**: Node.js is NOT required. Bun replaces Node entirely.
|
|
433
|
+
|
|
300
434
|
### Setup
|
|
301
435
|
|
|
302
436
|
```bash
|
|
@@ -309,26 +443,38 @@ bun install
|
|
|
309
443
|
|
|
310
444
|
# Run tests
|
|
311
445
|
bun test
|
|
312
|
-
|
|
313
|
-
# Start development server
|
|
314
|
-
bun run dev
|
|
315
446
|
```
|
|
316
447
|
|
|
317
448
|
### Commands
|
|
318
449
|
|
|
319
450
|
```bash
|
|
320
|
-
#
|
|
321
|
-
amalfa init
|
|
322
|
-
amalfa serve
|
|
323
|
-
amalfa stats
|
|
324
|
-
amalfa doctor
|
|
325
|
-
amalfa
|
|
451
|
+
# Core commands (after global install: bun install -g amalfa)
|
|
452
|
+
amalfa init # Initialize database from markdown
|
|
453
|
+
amalfa serve # Start MCP server (stdio)
|
|
454
|
+
amalfa stats # Show database statistics
|
|
455
|
+
amalfa doctor # Health check
|
|
456
|
+
amalfa setup-mcp # Generate MCP config
|
|
457
|
+
amalfa --help # Show help
|
|
458
|
+
|
|
459
|
+
# Search commands (CLI mode)
|
|
460
|
+
amalfa search <query> # Semantic search [--limit N] [--json]
|
|
461
|
+
amalfa read <node-id> # Read document content [--json]
|
|
462
|
+
amalfa explore <node-id> # Show related documents [--relation type] [--json]
|
|
463
|
+
amalfa list-sources # Show configured source directories
|
|
464
|
+
amalfa find-gaps # Discover unlinked documents [--limit N] [--threshold T] [--json]
|
|
465
|
+
amalfa inject-tags <path> <tags> # Add metadata to markdown [--json]
|
|
466
|
+
|
|
467
|
+
# Service management
|
|
468
|
+
amalfa servers # Show all service status
|
|
326
469
|
amalfa servers --dot # Generate DOT diagram
|
|
327
|
-
amalfa
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
amalfa
|
|
331
|
-
amalfa
|
|
470
|
+
amalfa stop-all # Stop all running services (alias: kill)
|
|
471
|
+
|
|
472
|
+
# Individual services (start|stop|status|restart)
|
|
473
|
+
amalfa daemon <action> # File watcher daemon
|
|
474
|
+
amalfa vector <action> # Vector embedding daemon
|
|
475
|
+
amalfa reranker <action> # Reranking daemon
|
|
476
|
+
amalfa sonar <action> # Sonar AI agent
|
|
477
|
+
amalfa ember <action> # Ember enrichment (scan|squash)
|
|
332
478
|
|
|
333
479
|
# Local development scripts (bun run <script>)
|
|
334
480
|
bun run servers # Test servers command
|
|
@@ -347,15 +493,16 @@ bun run format # Biome format
|
|
|
347
493
|
|
|
348
494
|
## Documentation
|
|
349
495
|
|
|
350
|
-
|
|
351
|
-
-
|
|
352
|
-
-
|
|
353
|
-
|
|
354
|
-
|
|
496
|
+
**Core Docs:**
|
|
497
|
+
- [MCP Tools Reference](docs/MCP-TOOLS.md) - Complete guide to agent tools
|
|
498
|
+
- [Architecture Deep Dive](docs/ARCHITECTURE.md) - Technical implementation details
|
|
499
|
+
- [Vision & Philosophy](docs/VISION-AGENT-LEARNING.md) - Why structured reflection works
|
|
500
|
+
- [User Manual](docs/USER-MANUAL.md) - Setup, maintenance, troubleshooting
|
|
355
501
|
|
|
356
|
-
|
|
357
|
-
-
|
|
358
|
-
-
|
|
502
|
+
**Playbooks:**
|
|
503
|
+
- [FAFCAS Protocol](playbooks/embeddings-and-fafcas-protocol-playbook.md) - Vector search optimization
|
|
504
|
+
- [Local-First Architecture](playbooks/local-first-vector-db-playbook.md) - Database patterns
|
|
505
|
+
- [Problem Solving](playbooks/problem-solving-playbook.md) - Debugging strategies
|
|
359
506
|
|
|
360
507
|
---
|
|
361
508
|
|