amalfa 1.0.0 → 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 (85) hide show
  1. package/README.md +226 -247
  2. package/amalfa.config.example.ts +8 -6
  3. package/docs/AGENT-METADATA-PATTERNS.md +1021 -0
  4. package/docs/CONFIG_E2E_VALIDATION.md +147 -0
  5. package/docs/CONFIG_UNIFICATION.md +187 -0
  6. package/docs/CONFIG_VALIDATION.md +103 -0
  7. package/docs/LEGACY_DEPRECATION.md +174 -0
  8. package/docs/MCP_SETUP.md +317 -0
  9. package/docs/QUICK_START_MCP.md +168 -0
  10. package/docs/SESSION-2026-01-06-METADATA-PATTERNS.md +346 -0
  11. package/docs/SETUP.md +464 -0
  12. package/docs/SETUP_COMPLETE.md +464 -0
  13. package/docs/VISION-AGENT-LEARNING.md +1242 -0
  14. package/docs/_current-config-status.md +93 -0
  15. package/package.json +6 -3
  16. package/polyvis.settings.json.bak +38 -0
  17. package/src/cli.ts +159 -31
  18. package/src/config/defaults.ts +73 -15
  19. package/src/core/VectorEngine.ts +18 -9
  20. package/src/daemon/index.ts +12 -8
  21. package/src/mcp/index.ts +62 -7
  22. package/src/pipeline/AmalfaIngestor.ts +22 -12
  23. package/src/pipeline/PreFlightAnalyzer.ts +434 -0
  24. package/src/resonance/DatabaseFactory.ts +3 -4
  25. package/src/resonance/db.ts +8 -6
  26. package/src/resonance/schema.ts +19 -1
  27. package/src/resonance/services/vector-daemon.ts +151 -0
  28. package/src/utils/DaemonManager.ts +147 -0
  29. package/src/utils/ZombieDefense.ts +5 -1
  30. package/:memory: +0 -0
  31. package/:memory:-shm +0 -0
  32. package/:memory:-wal +0 -0
  33. package/README.old.md +0 -112
  34. package/agents.config.json +0 -11
  35. package/drizzle/0000_minor_iron_fist.sql +0 -19
  36. package/drizzle/meta/0000_snapshot.json +0 -139
  37. package/drizzle/meta/_journal.json +0 -13
  38. package/example_usage.ts +0 -39
  39. package/experiment.sh +0 -35
  40. package/hello +0 -2
  41. package/index.html +0 -52
  42. package/knowledge/excalibur.md +0 -12
  43. package/plans/experience-graph-integration.md +0 -60
  44. package/prompts/gemini-king-mode-prompt.md +0 -46
  45. package/public/docs/MCP_TOOLS.md +0 -372
  46. package/schemas/README.md +0 -20
  47. package/schemas/cda.schema.json +0 -84
  48. package/schemas/conceptual-lexicon.schema.json +0 -75
  49. package/scratchpads/dummy-debrief-boxed.md +0 -39
  50. package/scratchpads/dummy-debrief.md +0 -27
  51. package/scratchpads/scratchpad-design.md +0 -50
  52. package/scratchpads/scratchpad-scrolling.md +0 -20
  53. package/scratchpads/scratchpad-toc-disappearance.md +0 -23
  54. package/scratchpads/scratchpad-toc.md +0 -28
  55. package/scratchpads/test_gardener.md +0 -7
  56. package/src/core/LLMClient.ts +0 -93
  57. package/src/core/TagEngine.ts +0 -56
  58. package/src/db/schema.ts +0 -46
  59. package/src/gardeners/AutoTagger.ts +0 -116
  60. package/src/pipeline/HarvesterPipeline.ts +0 -101
  61. package/src/pipeline/Ingestor.ts +0 -555
  62. package/src/resonance/cli/ingest.ts +0 -41
  63. package/src/resonance/cli/migrate.ts +0 -54
  64. package/src/resonance/config.ts +0 -40
  65. package/src/resonance/daemon.ts +0 -236
  66. package/src/resonance/pipeline/extract.ts +0 -89
  67. package/src/resonance/pipeline/transform_docs.ts +0 -60
  68. package/src/resonance/services/tokenizer.ts +0 -159
  69. package/src/resonance/transform/cda.ts +0 -393
  70. package/src/utils/EnvironmentVerifier.ts +0 -67
  71. package/substack/substack-playbook-1.md +0 -95
  72. package/substack/substack-playbook-2.md +0 -78
  73. package/tasks/ui-investigation.md +0 -26
  74. package/test-db +0 -0
  75. package/test-db-shm +0 -0
  76. package/test-db-wal +0 -0
  77. package/tests/canary/verify_pinch_check.ts +0 -44
  78. package/tests/fixtures/ingest_test.md +0 -12
  79. package/tests/fixtures/ingest_test_boxed.md +0 -13
  80. package/tests/fixtures/safety_test.md +0 -45
  81. package/tests/fixtures/safety_test_boxed.md +0 -49
  82. package/tests/fixtures/tagged_output.md +0 -49
  83. package/tests/fixtures/tagged_test.md +0 -49
  84. package/tests/mcp-server-settings.json +0 -8
  85. package/verify-embedder.ts +0 -54
@@ -0,0 +1,147 @@
1
+ # Configuration System End-to-End Validation
2
+
3
+ **Date**: 2026-01-07
4
+ **Test Status**: ✅ PASSED
5
+ **Database**: `.amalfa/multi-source-test.db`
6
+ **Test Script**: `scripts/test-config-search.ts`
7
+
8
+ ## Test Overview
9
+
10
+ Validated the unified configuration system end-to-end after migrating from `polyvis.settings.json` to `amalfa.config.json`.
11
+
12
+ ## Test Sequence
13
+
14
+ ### 1. Document Creation
15
+ Created test document: `../polyvis/docs/config-unification-test.md`
16
+ - Purpose: Validate indexing and search
17
+ - Content: Configuration migration strategy details
18
+ - Tags: #configuration #migration #typescript #amalfa #testing
19
+
20
+ ### 2. Ingestion
21
+ ```bash
22
+ bun run src/cli.ts init
23
+ ```
24
+
25
+ **Results**:
26
+ - Files processed: 96 (including new test document)
27
+ - Nodes created: 95
28
+ - Embeddings: 95 (384-dim BAAI/bge-small-en-v1.5)
29
+ - Database: `.amalfa/multi-source-test.db` (0.79 MB)
30
+
31
+ ### 3. Vector Search Tests
32
+
33
+ **Query 1**: "configuration migration strategy"
34
+ ```
35
+ 1. [84.1%] config-unification-test.md ✅
36
+ 2. [79.8%] embeddings-and-fafcas-protocol-playbook.md
37
+ 3. [79.3%] report-graph-first-strategy.md
38
+ ```
39
+
40
+ **Query 2**: "TypeScript compilation errors"
41
+ ```
42
+ 1. [76.0%] tooling-showcase.md
43
+ 2. [75.6%] problem-solving-playbook.md
44
+ 3. [74.8%] compare-src-and-resonance-folders.md
45
+ ```
46
+
47
+ **Query 3**: "database path validation"
48
+ ```
49
+ 1. [77.3%] database-capabilities.md
50
+ 2. [76.6%] schema-playbook.md
51
+ 3. [76.4%] data-architecture.md
52
+ ```
53
+
54
+ ### 4. Test Document Verification
55
+
56
+ **Query**: "config unification test document clean-slate migration"
57
+
58
+ **Result**: ✅ **SUCCESS**
59
+ - Best match: `config-unification-test.md`
60
+ - Score: 83.5%
61
+ - Status: TEST DOCUMENT INDEXED SUCCESSFULLY!
62
+
63
+ ## System Validation
64
+
65
+ ### Configuration Loading ✅
66
+ - Config file: `amalfa.config.json`
67
+ - Sources: `../polyvis/docs`, `../polyvis/playbooks`
68
+ - Database: `.amalfa/multi-source-test.db`
69
+ - Model: `BAAI/bge-small-en-v1.5`
70
+
71
+ ### Database Access ✅
72
+ - Path loaded from config (not hardcoded)
73
+ - WAL mode active
74
+ - 95 nodes with embeddings
75
+ - Full-text search disabled (hollow nodes)
76
+
77
+ ### Vector Search ✅
78
+ - Model initialized correctly
79
+ - Embeddings generated
80
+ - Dot product similarity working
81
+ - Results ranked by relevance
82
+
83
+ ### Semantic Accuracy ✅
84
+ - Query 1: 84.1% match on exact test document
85
+ - Query 2-3: 76-77% matches on related technical content
86
+ - Clear differentiation between topics
87
+
88
+ ## Performance Metrics
89
+
90
+ - **Database size**: 0.79 MB (95 nodes)
91
+ - **Ingestion time**: ~0.26 seconds (96 files)
92
+ - **Search latency**: <100ms per query
93
+ - **Best match accuracy**: 83.5% for exact topic match
94
+
95
+ ## Configuration Benefits Observed
96
+
97
+ 1. **Single Source of Truth**: No ambiguity about config location
98
+ 2. **Lazy Loading**: Config loaded only when needed by each command
99
+ 3. **Predictable Paths**: All paths resolved from config
100
+ 4. **Clean Migration**: Zero legacy imports remain
101
+ 5. **Validation Tooling**: `validate-config` provides safety net
102
+
103
+ ## Issues Encountered
104
+
105
+ None. System working as expected.
106
+
107
+ ## Related Tests
108
+
109
+ - **CLI Test**: `amalfa stats` ✅
110
+ - **Daemon Test**: File watcher started successfully ✅
111
+ - **MCP Server**: Ready for Warp Preview testing ⏭️
112
+
113
+ ## Conclusion
114
+
115
+ The unified configuration system migration is **complete and validated**. All components:
116
+ - Load config from `amalfa.config.json`
117
+ - Access database from config path
118
+ - Perform vector search correctly
119
+ - Index new documents successfully
120
+
121
+ **Recommendation**: Ship to production. System stable and performant.
122
+
123
+ ---
124
+
125
+ ## Test Reproduction
126
+
127
+ To reproduce this test:
128
+
129
+ ```bash
130
+ # 1. Create test document
131
+ vim ../polyvis/docs/test-doc.md
132
+
133
+ # 2. Ingest
134
+ bun run src/cli.ts init
135
+
136
+ # 3. Run validation
137
+ bun run scripts/test-config-search.ts
138
+
139
+ # Expected: All tests pass, document indexed, searches work
140
+ ```
141
+
142
+ ## Next Steps
143
+
144
+ 1. ✅ Config system validated
145
+ 2. ⏭️ Test MCP server in Warp Preview
146
+ 3. ⏭️ Test daemon file watching (auto-update on save)
147
+ 4. ⏭️ Production deployment readiness check
@@ -0,0 +1,187 @@
1
+ # Configuration Unification Plan
2
+
3
+ **Date:** 2026-01-07
4
+ **Status:** Proposed
5
+
6
+ ## Current State
7
+
8
+ ### Two Active Configs
9
+
10
+ 1. **`amalfa.config.json`** (Primary)
11
+ - User-facing AMALFA configuration
12
+ - Clean, minimal, focused
13
+ - Controls: sources, database, embeddings, file watching
14
+ - Loaded by: `src/config/defaults.ts`
15
+
16
+ 2. **`polyvis.settings.json`** (Legacy)
17
+ - Resonance pipeline configuration
18
+ - Complex, with graph tuning and persona paths
19
+ - Controls: legacy database paths, graph algorithms, persona fixtures
20
+ - Loaded by: `src/resonance/config.ts`
21
+
22
+ ### Issue
23
+
24
+ - Confusing for new users (two configs)
25
+ - Potential for conflicting settings (both define database paths)
26
+ - Unclear which config to edit
27
+
28
+ ## Decision: Keep Separate (For Now)
29
+
30
+ **Rationale:**
31
+
32
+ 1. **Different audiences:**
33
+ - `amalfa.config.json` - End users configuring AMALFA
34
+ - `polyvis.settings.json` - Internal Resonance library settings
35
+
36
+ 2. **Different lifecycles:**
37
+ - AMALFA config is stable and user-friendly
38
+ - Resonance config will be deprecated as features migrate
39
+
40
+ 3. **Clean migration path:**
41
+ - Mark `polyvis.settings.json` as deprecated
42
+ - Gradually move needed settings to `amalfa.config.json`
43
+ - Remove when fully migrated
44
+
45
+ ## Recommendation: Document Ownership
46
+
47
+ Create clear boundaries:
48
+
49
+ ### `amalfa.config.json` - AMALFA Core (User-Facing)
50
+
51
+ ```json
52
+ {
53
+ "sources": ["./docs", "./playbooks"],
54
+ "database": ".amalfa/resonance.db",
55
+ "embeddings": {
56
+ "model": "BAAI/bge-small-en-v1.5",
57
+ "dimensions": 384
58
+ },
59
+ "watch": {
60
+ "enabled": true,
61
+ "debounce": 1000
62
+ },
63
+ "excludePatterns": ["node_modules", ".git", ".amalfa"],
64
+
65
+ // Future additions (not yet implemented):
66
+ // "daemons": {
67
+ // "vector": {
68
+ // "enabled": true,
69
+ // "port": 3010 // Only if really needed
70
+ // },
71
+ // "watcher": {
72
+ // "enabled": true
73
+ // }
74
+ // }
75
+ }
76
+ ```
77
+
78
+ **Controls:**
79
+ - MCP server behavior
80
+ - File watcher daemon
81
+ - Vector daemon
82
+ - Database location
83
+ - Source directories
84
+ - Embedding model selection
85
+
86
+ ### `polyvis.settings.json` - Resonance Library (Internal/Deprecated)
87
+
88
+ **Current usage:**
89
+ - Graph tuning parameters (Louvain algorithm)
90
+ - Persona fixture paths (lexicon, CDA)
91
+ - Legacy "experience" source structure
92
+
93
+ **Migration path:**
94
+ 1. Mark file as deprecated in v1.0
95
+ 2. Add warning when loaded: "polyvis.settings.json is deprecated, migrate to amalfa.config.json"
96
+ 3. Remove in v2.0
97
+
98
+ **What to migrate:**
99
+ - Graph tuning → `amalfa.config.json` (if users need it)
100
+ - Persona paths → Hard-coded defaults or removed (likely unused)
101
+ - Experience sources → Already handled by `sources` in amalfa.config.json
102
+
103
+ ## Port Numbers Decision
104
+
105
+ **NO** - Do not add port configuration to `amalfa.config.json`
106
+
107
+ **Reasons:**
108
+ 1. Ports rarely change in single-user, local-first systems
109
+ 2. Adds complexity for minimal benefit
110
+ 3. Already support env var override: `VECTOR_PORT=3011 bun run start`
111
+
112
+ **Current approach (keep):**
113
+ ```typescript
114
+ // Code constant with env override
115
+ const PORT = Number(process.env.VECTOR_PORT || 3010);
116
+ ```
117
+
118
+ **When to add ports to config:**
119
+ - Multi-user deployments
120
+ - Cloud-native setups
121
+ - Conflict resolution needs
122
+
123
+ For AMALFA's use case: **Not needed.**
124
+
125
+ ## Action Plan
126
+
127
+ ### Phase 1: Document (Now)
128
+ - [x] Create this document
129
+ - [ ] Update `_current-config-status.md` with clear ownership
130
+ - [ ] Add comments to `polyvis.settings.json` marking as deprecated
131
+ - [ ] Update README with config documentation
132
+
133
+ ### Phase 2: Deprecation Warnings (v0.9)
134
+ - [ ] Add warning log when `polyvis.settings.json` is loaded
135
+ - [ ] Migrate graph tuning to `amalfa.config.json` (optional section)
136
+ - [ ] Remove unused persona paths from codebase
137
+
138
+ ### Phase 3: Removal (v2.0)
139
+ - [ ] Delete `polyvis.settings.json`
140
+ - [ ] Remove `src/resonance/config.ts`
141
+ - [ ] Single config: `amalfa.config.json`
142
+
143
+ ## Example: Unified Config (Future v2.0)
144
+
145
+ ```json
146
+ {
147
+ "sources": ["./docs", "./playbooks"],
148
+ "database": ".amalfa/resonance.db",
149
+
150
+ "embeddings": {
151
+ "model": "BAAI/bge-small-en-v1.5",
152
+ "dimensions": 384
153
+ },
154
+
155
+ "watch": {
156
+ "enabled": true,
157
+ "debounce": 1000
158
+ },
159
+
160
+ "excludePatterns": ["node_modules", ".git", ".amalfa"],
161
+
162
+ "graph": {
163
+ "tuning": {
164
+ "louvain": {
165
+ "resolution": 0.3
166
+ }
167
+ }
168
+ }
169
+ }
170
+ ```
171
+
172
+ ## Configuration Schema (Future)
173
+
174
+ Consider adding schema validation:
175
+ - `amalfa.config.schema.json` for IDE autocomplete
176
+ - Validate on load with `zod` or similar
177
+ - Clear error messages for invalid config
178
+
179
+ ## Summary
180
+
181
+ **Decision:** Keep configs separate for now, document clearly, deprecate `polyvis.settings.json` gradually.
182
+
183
+ **Port numbers:** NO - use env vars, keep config simple.
184
+
185
+ **Timeline:**
186
+ - v1.0: Document + deprecation warnings
187
+ - v2.0: Single unified config
@@ -0,0 +1,103 @@
1
+ # Configuration Validation Results
2
+
3
+ **Date**: 2026-01-07
4
+ **Status**: ✅ No critical conflicts detected
5
+ **Command**: `bun run validate-config`
6
+
7
+ ## Summary
8
+
9
+ The validation script checked for conflicts between `amalfa.config.json` (user-facing) and `polyvis.settings.json` (legacy/deprecated). Found **1 warning** and **2 info items** - no blocking issues.
10
+
11
+ ## Findings
12
+
13
+ ### ⚠️ Warning: Database Path Mismatch
14
+
15
+ **Issue**: Two different database paths are configured:
16
+ - `amalfa.config.json`: `.amalfa/multi-source-test.db`
17
+ - `polyvis.settings.json`: `public/resonance.db`
18
+
19
+ **Impact**: Medium - The MCP server and daemon use `amalfa.config.json`, so they operate on `.amalfa/multi-source-test.db`. Legacy Resonance utilities may still reference `public/resonance.db`.
20
+
21
+ **Resolution**: This is **intentional** for the current testing setup:
22
+ - `.amalfa/multi-source-test.db` is the active database used by MCP server
23
+ - `public/resonance.db` is legacy and only used by deprecated Resonance pipelines
24
+ - No conflict exists because only one database is actively written to
25
+
26
+ **Action Required**: None for now. When migrating to v2.0, remove `polyvis.settings.json` entirely.
27
+
28
+ ---
29
+
30
+ ### ℹ️ Info: Embedding Configuration
31
+
32
+ **Finding**: Embedding model controlled by `amalfa.config.json`:
33
+ - Model: `BAAI/bge-small-en-v1.5`
34
+ - Dimensions: 384
35
+
36
+ **Note**: `polyvis.settings.json` does not define embeddings - this is correct. All embedding configuration lives in `amalfa.config.json`.
37
+
38
+ ---
39
+
40
+ ### ℹ️ Info: Source Directory Configuration
41
+
42
+ **Finding**: Different source directories defined:
43
+ - `amalfa.config.json` (MCP ingestion): `../polyvis/docs`, `../polyvis/playbooks`
44
+ - `polyvis.settings.json` (legacy): `debriefs`, `playbooks`, `briefs`, `docs`
45
+
46
+ **Explanation**: These serve different purposes:
47
+ - **MCP server** ingests from external Polyvis project docs (cross-project knowledge sharing)
48
+ - **Legacy Resonance** processes local project artifacts
49
+
50
+ **Status**: Working as intended - no conflict.
51
+
52
+ ---
53
+
54
+ ## Validation Script Details
55
+
56
+ **Location**: `scripts/validate-config.ts`
57
+
58
+ **Checks**:
59
+ 1. ✅ Database path conflicts
60
+ 2. ✅ Multiple database file detection
61
+ 3. ✅ Embedding model consistency
62
+ 4. ✅ Source directory existence
63
+ 5. ✅ Deprecation notice presence
64
+
65
+ **Usage**:
66
+ ```bash
67
+ bun run validate-config
68
+ ```
69
+
70
+ **Exit Codes**:
71
+ - `0`: No errors (warnings/info allowed)
72
+ - `1`: Critical errors detected
73
+
74
+ ---
75
+
76
+ ## Configuration Ownership
77
+
78
+ | Setting | Config File | Status |
79
+ |---------|------------|--------|
80
+ | Database path | `amalfa.config.json` | ✅ Active |
81
+ | Embedding model | `amalfa.config.json` | ✅ Active |
82
+ | MCP source dirs | `amalfa.config.json` | ✅ Active |
83
+ | Watch settings | `amalfa.config.json` | ✅ Active |
84
+ | Legacy Resonance paths | `polyvis.settings.json` | ⚠️ Deprecated |
85
+ | Graph tuning params | `polyvis.settings.json` | ⚠️ Needs migration |
86
+
87
+ ---
88
+
89
+ ## Next Steps
90
+
91
+ 1. ✅ **Completed**: Validation script created
92
+ 2. ✅ **Completed**: Documentation of findings
93
+ 3. 🔄 **Pending**: Add deprecation warning when `polyvis.settings.json` is loaded
94
+ 4. 🔄 **Pending**: Migrate graph tuning parameters to `amalfa.config.json`
95
+ 5. 🔄 **Future (v2.0)**: Remove `polyvis.settings.json` entirely
96
+
97
+ ---
98
+
99
+ ## Related Documentation
100
+
101
+ - [Configuration Unification Strategy](./CONFIG_UNIFICATION.md)
102
+ - [Current Config Status](./docs/_current-config-status.md)
103
+ - [MCP Setup Guide](./MCP_SETUP.md)
@@ -0,0 +1,174 @@
1
+ # Legacy Configuration Deprecation Plan
2
+
3
+ **Target**: Remove `polyvis.settings.json` and consolidate to `amalfa.config.json`
4
+ **Timeline**: v1.0 (deprecation warnings) → v2.0 (removal)
5
+ **Status**: 🔄 In Progress
6
+
7
+ ## Current State
8
+
9
+ ### Files Using `polyvis.settings.json`
10
+
11
+ **Active (needs migration)**:
12
+ 1. `src/resonance/config.ts` - ResonanceConfig loader (✅ deprecation warning added)
13
+ 2. `src/resonance/db.ts` - ResonanceDB uses legacy paths
14
+ 3. `src/resonance/DatabaseFactory.ts` - Factory pattern for DB instances
15
+ 4. `src/core/VectorEngine.ts` - Vector search initialization
16
+ 5. `src/utils/EnvironmentVerifier.ts` - Environment validation
17
+ 6. `src/pipeline/HarvesterPipeline.ts` - Tag harvesting (soft dependency)
18
+
19
+ **Legacy scripts** (low priority):
20
+ - `scripts/verify/*` - Debug/diagnostic scripts (15+ files)
21
+ - `scripts/cli/harvest.ts` - Concept harvesting CLI
22
+ - Various test/lab utilities
23
+
24
+ ### Configuration Comparison
25
+
26
+ | Feature | polyvis.settings.json | amalfa.config.json |
27
+ |---------|----------------------|-------------------|
28
+ | Database path | `public/resonance.db` | `.amalfa/multi-source-test.db` |
29
+ | Source directories | `debriefs`, `playbooks`, `briefs`, `docs` | `../polyvis/docs`, `../polyvis/playbooks` |
30
+ | Embeddings | ❌ Not defined | ✅ BAAI/bge-small-en-v1.5 (384d) |
31
+ | Watch config | ❌ Not defined | ✅ Enabled, 1000ms debounce |
32
+ | Graph tuning | ✅ Louvain params | ❌ Needs migration |
33
+ | Persona fixtures | ✅ Lexicon, CDA | ❌ Needs migration |
34
+
35
+ ---
36
+
37
+ ## Migration Strategy
38
+
39
+ ### Phase 1: Expand amalfa.config.json (Current)
40
+
41
+ Add missing features from `polyvis.settings.json` to `amalfa.config.json`:
42
+
43
+ ```json
44
+ {
45
+ "sources": ["../polyvis/docs", "../polyvis/playbooks"],
46
+ "database": ".amalfa/multi-source-test.db",
47
+ "embeddings": {
48
+ "model": "BAAI/bge-small-en-v1.5",
49
+ "dimensions": 384
50
+ },
51
+ "watch": {
52
+ "enabled": true,
53
+ "debounce": 1000
54
+ },
55
+ "excludePatterns": ["node_modules", ".git", ".amalfa"],
56
+
57
+ // NEW: Migrate from polyvis.settings.json
58
+ "graph": {
59
+ "tuning": {
60
+ "louvain": {
61
+ "persona": 0.3,
62
+ "experience": 0.25
63
+ }
64
+ }
65
+ },
66
+ "fixtures": {
67
+ "lexicon": "scripts/fixtures/conceptual-lexicon-ref-v1.79.json",
68
+ "cda": "scripts/fixtures/cda-ref-v63.json"
69
+ }
70
+ }
71
+ ```
72
+
73
+ ### Phase 2: Update Code to Use amalfa.config.json
74
+
75
+ 1. **Modify `src/resonance/config.ts`**:
76
+ - Try loading `amalfa.config.json` first
77
+ - Fall back to `polyvis.settings.json` with deprecation warning
78
+ - Map unified config structure to ResonanceConfig
79
+
80
+ 2. **Update ResonanceDB initialization**:
81
+ - Accept config object in constructor
82
+ - Use `amalfa.config.json` paths
83
+
84
+ 3. **Migrate graph tuning parameters**:
85
+ - Add `graph.tuning` to AmalfaConfig interface
86
+ - Use in Louvain clustering algorithms
87
+
88
+ 4. **Handle persona fixtures**:
89
+ - Add `fixtures` section to AmalfaConfig
90
+ - Update HarvesterPipeline to read from new config
91
+
92
+ ### Phase 3: Update Scripts
93
+
94
+ - Mark all `scripts/verify/*` as legacy (add README note)
95
+ - Update `scripts/cli/harvest.ts` to use unified config
96
+ - Create `scripts/migrate-config.ts` tool to auto-convert
97
+
98
+ ### Phase 4: Remove Legacy (v2.0)
99
+
100
+ - Delete `polyvis.settings.json`
101
+ - Remove `src/resonance/config.ts` fallback logic
102
+ - Remove EnvironmentVerifier (replaced by modern config validation)
103
+ - Archive legacy scripts to `scripts/legacy/`
104
+
105
+ ---
106
+
107
+ ## Migration Checklist
108
+
109
+ ### v1.0 (Current Release)
110
+ - [x] Add deprecation warning to `loadConfig()` (src/resonance/config.ts)
111
+ - [x] Document current config conflicts (docs/CONFIG_VALIDATION.md)
112
+ - [ ] Extend `amalfa.config.json` schema with graph tuning
113
+ - [ ] Extend `amalfa.config.json` schema with fixtures
114
+ - [ ] Update `src/config/defaults.ts` with new fields
115
+ - [ ] Create config migration helper script
116
+ - [ ] Test all MCP commands with unified config
117
+
118
+ ### v1.1 (Transition Period)
119
+ - [ ] Update ResonanceDB to accept unified config
120
+ - [ ] Update VectorEngine to use unified config
121
+ - [ ] Make polyvis.settings.json fully optional
122
+ - [ ] Add config auto-migration on first run
123
+ - [ ] Update all documentation to reference amalfa.config.json only
124
+
125
+ ### v2.0 (Legacy Removal)
126
+ - [ ] Remove polyvis.settings.json from repo
127
+ - [ ] Remove ResonanceConfig loader fallback
128
+ - [ ] Archive legacy verify scripts
129
+ - [ ] Remove EnvironmentVerifier
130
+ - [ ] Update CHANGELOG with breaking changes
131
+
132
+ ---
133
+
134
+ ## Testing Strategy
135
+
136
+ 1. **Backward compatibility** (v1.0-1.1):
137
+ - Both configs work simultaneously
138
+ - Deprecation warnings guide users
139
+ - No breaking changes
140
+
141
+ 2. **Migration path validation**:
142
+ - Test with only `amalfa.config.json`
143
+ - Test with only `polyvis.settings.json` (warnings)
144
+ - Test with both (unified config takes precedence)
145
+
146
+ 3. **Removal readiness** (v2.0):
147
+ - All tests pass without polyvis.settings.json
148
+ - No imports of `src/resonance/config.ts` legacy loader
149
+ - Documentation references only unified config
150
+
151
+ ---
152
+
153
+ ## Naming Review (Post-Migration)
154
+
155
+ Once we have a single config file, review these names:
156
+
157
+ **Consider renaming**:
158
+ - `.amalfa/` → Could stay, or rename to `.amalfa-data/`?
159
+ - `ResonanceDB` → `AmalfaDB`? (breaks API)
160
+ - `sources` → `ingest` or `watch_dirs`?
161
+ - `embeddings.model` → More descriptive field names?
162
+
163
+ **Keep as-is**:
164
+ - `database` - Clear
165
+ - `watch` - Standard terminology
166
+ - `excludePatterns` - Matches .gitignore convention
167
+
168
+ ---
169
+
170
+ ## Related Documentation
171
+
172
+ - [Configuration Unification Strategy](./CONFIG_UNIFICATION.md)
173
+ - [Configuration Validation](./CONFIG_VALIDATION.md)
174
+ - [MCP Setup Guide](./MCP_SETUP.md)