@terronex/aifbin-recall 0.1.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/CONTRIBUTING.md +65 -0
- package/LICENSE +21 -0
- package/NOTICE +36 -0
- package/README.md +250 -0
- package/dist/cli.d.ts +6 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +182 -0
- package/dist/cli.js.map +1 -0
- package/dist/db.d.ts +29 -0
- package/dist/db.d.ts.map +1 -0
- package/dist/db.js +252 -0
- package/dist/db.js.map +1 -0
- package/dist/embedder.d.ts +47 -0
- package/dist/embedder.d.ts.map +1 -0
- package/dist/embedder.js +152 -0
- package/dist/embedder.js.map +1 -0
- package/dist/index.d.ts +27 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +45 -0
- package/dist/index.js.map +1 -0
- package/dist/indexer.d.ts +34 -0
- package/dist/indexer.d.ts.map +1 -0
- package/dist/indexer.js +246 -0
- package/dist/indexer.js.map +1 -0
- package/dist/mcp.d.ts +7 -0
- package/dist/mcp.d.ts.map +1 -0
- package/dist/mcp.js +207 -0
- package/dist/mcp.js.map +1 -0
- package/dist/search.d.ts +27 -0
- package/dist/search.d.ts.map +1 -0
- package/dist/search.js +159 -0
- package/dist/search.js.map +1 -0
- package/dist/server.d.ts +13 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +250 -0
- package/dist/server.js.map +1 -0
- package/dist/types.d.ts +79 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +20 -0
- package/dist/types.js.map +1 -0
- package/package.json +64 -0
- package/src/cli.ts +195 -0
- package/src/db.ts +295 -0
- package/src/embedder.ts +175 -0
- package/src/index.ts +46 -0
- package/src/indexer.ts +272 -0
- package/src/mcp.ts +244 -0
- package/src/search.ts +201 -0
- package/src/server.ts +270 -0
- package/src/types.ts +103 -0
- package/tsconfig.json +20 -0
package/CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# Contributing to AIF-BIN Recall
|
|
2
|
+
|
|
3
|
+
Thank you for your interest in contributing to AIF-BIN Recall!
|
|
4
|
+
|
|
5
|
+
## How to Contribute
|
|
6
|
+
|
|
7
|
+
### Reporting Bugs
|
|
8
|
+
|
|
9
|
+
- Check existing issues first to avoid duplicates
|
|
10
|
+
- Use the bug report template
|
|
11
|
+
- Include reproduction steps, expected vs actual behavior
|
|
12
|
+
- Include your environment (OS, Node.js version, etc.)
|
|
13
|
+
|
|
14
|
+
### Suggesting Features
|
|
15
|
+
|
|
16
|
+
- Open an issue with the feature request template
|
|
17
|
+
- Explain the use case and why it would be valuable
|
|
18
|
+
- Be open to discussion and iteration
|
|
19
|
+
|
|
20
|
+
### Pull Requests
|
|
21
|
+
|
|
22
|
+
1. Fork the repository
|
|
23
|
+
2. Create a feature branch (`git checkout -b feature/my-feature`)
|
|
24
|
+
3. Make your changes
|
|
25
|
+
4. Run tests (`npm test`)
|
|
26
|
+
5. Commit with clear messages (`git commit -m "feat: add new feature"`)
|
|
27
|
+
6. Push to your fork (`git push origin feature/my-feature`)
|
|
28
|
+
7. Open a pull request
|
|
29
|
+
|
|
30
|
+
### Commit Message Format
|
|
31
|
+
|
|
32
|
+
We follow [Conventional Commits](https://www.conventionalcommits.org/):
|
|
33
|
+
|
|
34
|
+
- `feat:` — New feature
|
|
35
|
+
- `fix:` — Bug fix
|
|
36
|
+
- `docs:` — Documentation changes
|
|
37
|
+
- `test:` — Adding or updating tests
|
|
38
|
+
- `refactor:` — Code changes that neither fix bugs nor add features
|
|
39
|
+
- `perf:` — Performance improvements
|
|
40
|
+
- `chore:` — Maintenance tasks
|
|
41
|
+
|
|
42
|
+
### Code Style
|
|
43
|
+
|
|
44
|
+
- Use TypeScript
|
|
45
|
+
- Follow existing code patterns
|
|
46
|
+
- Add types for all public APIs
|
|
47
|
+
- Write tests for new functionality
|
|
48
|
+
|
|
49
|
+
## Development Setup
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
git clone https://github.com/Terronex-dev/aifbin-recall.git
|
|
53
|
+
cd aifbin-recall
|
|
54
|
+
npm install
|
|
55
|
+
npm run build
|
|
56
|
+
npm test
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Questions?
|
|
60
|
+
|
|
61
|
+
Open an issue or reach out via the project discussions.
|
|
62
|
+
|
|
63
|
+
## License
|
|
64
|
+
|
|
65
|
+
By contributing, you agree that your contributions will be licensed under the MIT License.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Terronex
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/NOTICE
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
AIF-BIN Recall
|
|
2
|
+
Copyright 2026 Terronex
|
|
3
|
+
|
|
4
|
+
This product includes software developed by Terronex.
|
|
5
|
+
https://github.com/Terronex-dev
|
|
6
|
+
|
|
7
|
+
TRADEMARKS
|
|
8
|
+
----------
|
|
9
|
+
"AIF-BIN", "AIF-BIN Recall", "AIF-BIN Pro", and the Terronex name and logo
|
|
10
|
+
are trademarks of Terronex. Use of these trademarks without prior written
|
|
11
|
+
permission from Terronex is prohibited.
|
|
12
|
+
|
|
13
|
+
The MIT license granted herein does not include any license to use
|
|
14
|
+
Terronex trademarks. You may not use the Terronex name, logo, or
|
|
15
|
+
AIF-BIN trademarks to endorse or promote products derived from this
|
|
16
|
+
software without specific prior written permission.
|
|
17
|
+
|
|
18
|
+
THIRD-PARTY COMPONENTS
|
|
19
|
+
----------------------
|
|
20
|
+
This software includes the following third-party components:
|
|
21
|
+
|
|
22
|
+
- @xenova/transformers (Apache 2.0) - Local ML model inference
|
|
23
|
+
- better-sqlite3 (MIT) - SQLite bindings
|
|
24
|
+
- express (MIT) - HTTP server
|
|
25
|
+
- msgpackr (MIT) - MessagePack encoding
|
|
26
|
+
- commander (MIT) - CLI framework
|
|
27
|
+
- @modelcontextprotocol/sdk (MIT) - MCP server
|
|
28
|
+
|
|
29
|
+
See package.json for complete dependency list.
|
|
30
|
+
|
|
31
|
+
ATTRIBUTION
|
|
32
|
+
-----------
|
|
33
|
+
When redistributing this software or derivative works, you must:
|
|
34
|
+
1. Include this NOTICE file
|
|
35
|
+
2. Include the LICENSE file
|
|
36
|
+
3. Not use Terronex trademarks without permission
|
package/README.md
ADDED
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
# AIF-BIN Recall
|
|
2
|
+
|
|
3
|
+
**Local-first memory server for AI agents.**
|
|
4
|
+
|
|
5
|
+
AIF-BIN Recall indexes collections of [AIF-BIN](https://github.com/Terronex-dev/aifbin) semantic memory files and provides fast retrieval via HTTP API and MCP (Model Context Protocol) for AI agent integration.
|
|
6
|
+
|
|
7
|
+
## Features
|
|
8
|
+
|
|
9
|
+
- **Semantic Search** — Query memories by meaning using embedded vectors
|
|
10
|
+
- **Hybrid Retrieval** — Combine vector similarity with keyword matching
|
|
11
|
+
- **MCP Server** — Native integration with AI agents (Claude, OpenClaw, etc.)
|
|
12
|
+
- **HTTP API** — RESTful endpoints for any client
|
|
13
|
+
- **Zero Cloud** — Fully local, no external services required
|
|
14
|
+
- **Collection Management** — Organize memories into logical groups
|
|
15
|
+
|
|
16
|
+
## Requirements
|
|
17
|
+
|
|
18
|
+
- Node.js 18+ or Bun 1.0+
|
|
19
|
+
- npm, yarn, or pnpm
|
|
20
|
+
|
|
21
|
+
## Installation
|
|
22
|
+
|
|
23
|
+
### Linux / macOS
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
# Using npm (recommended)
|
|
27
|
+
npm install -g @terronex/aifbin-recall
|
|
28
|
+
|
|
29
|
+
# Using Bun
|
|
30
|
+
bun install -g @terronex/aifbin-recall
|
|
31
|
+
|
|
32
|
+
# Using yarn
|
|
33
|
+
yarn global add @terronex/aifbin-recall
|
|
34
|
+
|
|
35
|
+
# Using pnpm
|
|
36
|
+
pnpm add -g @terronex/aifbin-recall
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### Windows
|
|
40
|
+
|
|
41
|
+
```powershell
|
|
42
|
+
# Using npm (recommended)
|
|
43
|
+
npm install -g @terronex/aifbin-recall
|
|
44
|
+
|
|
45
|
+
# Using yarn
|
|
46
|
+
yarn global add @terronex/aifbin-recall
|
|
47
|
+
|
|
48
|
+
# Using pnpm
|
|
49
|
+
pnpm add -g @terronex/aifbin-recall
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### From Source
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
git clone https://github.com/Terronex-dev/aifbin-recall.git
|
|
56
|
+
cd aifbin-recall
|
|
57
|
+
npm install
|
|
58
|
+
npm run build
|
|
59
|
+
npm link
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### Verify Installation
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
aifbin-recall --version
|
|
66
|
+
# Output: 0.1.0
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Quick Start
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
# Index a directory of .aif-bin files
|
|
73
|
+
aifbin-recall index ./memories --collection my-project
|
|
74
|
+
|
|
75
|
+
# Start the server
|
|
76
|
+
aifbin-recall serve
|
|
77
|
+
|
|
78
|
+
# Search via CLI
|
|
79
|
+
aifbin-recall search "what decisions did we make about the API?"
|
|
80
|
+
|
|
81
|
+
# Or query the HTTP API
|
|
82
|
+
curl "http://localhost:3847/search?q=API+decisions&collection=my-project"
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## CLI Reference
|
|
86
|
+
|
|
87
|
+
| Command | Description |
|
|
88
|
+
|---------|-------------|
|
|
89
|
+
| `aifbin-recall index <dir>` | Index .aif-bin files from a directory |
|
|
90
|
+
| `aifbin-recall serve` | Start the HTTP server |
|
|
91
|
+
| `aifbin-recall mcp` | Start the MCP server for AI agents |
|
|
92
|
+
| `aifbin-recall search <query>` | Search memories via CLI |
|
|
93
|
+
| `aifbin-recall collections` | List all collections |
|
|
94
|
+
| `aifbin-recall info` | Show database information |
|
|
95
|
+
|
|
96
|
+
### Index Options
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
aifbin-recall index ./memories \
|
|
100
|
+
--collection my-project \
|
|
101
|
+
--recursive \
|
|
102
|
+
--db ~/.aifbin-recall/custom.db
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### Serve Options
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
aifbin-recall serve \
|
|
109
|
+
--port 3847 \
|
|
110
|
+
--host 0.0.0.0
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### Search Options
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
aifbin-recall search "your query" \
|
|
117
|
+
--collection my-project \
|
|
118
|
+
--limit 10 \
|
|
119
|
+
--model minilm
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
## MCP Integration
|
|
123
|
+
|
|
124
|
+
Add AIF-BIN Recall to your AI agent's MCP config:
|
|
125
|
+
|
|
126
|
+
```json
|
|
127
|
+
{
|
|
128
|
+
"mcpServers": {
|
|
129
|
+
"aifbin-recall": {
|
|
130
|
+
"command": "aifbin-recall",
|
|
131
|
+
"args": ["mcp"]
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
Available MCP tools:
|
|
138
|
+
|
|
139
|
+
| Tool | Description |
|
|
140
|
+
|------|-------------|
|
|
141
|
+
| `recall_search` | Semantic search across collections |
|
|
142
|
+
| `recall_get` | Retrieve specific memories by ID |
|
|
143
|
+
| `recall_collections` | List available collections |
|
|
144
|
+
| `recall_index` | Add new files to a collection |
|
|
145
|
+
|
|
146
|
+
## HTTP API
|
|
147
|
+
|
|
148
|
+
| Endpoint | Method | Description |
|
|
149
|
+
|----------|--------|-------------|
|
|
150
|
+
| `/search` | GET/POST | Semantic search with optional filters |
|
|
151
|
+
| `/recall/:id` | GET | Retrieve specific memory chunk |
|
|
152
|
+
| `/collections` | GET | List all collections |
|
|
153
|
+
| `/collections/:name` | POST | Create/update collection |
|
|
154
|
+
| `/index` | POST | Index directory of .aif-bin files |
|
|
155
|
+
| `/health` | GET | Server health check |
|
|
156
|
+
|
|
157
|
+
### Search Request
|
|
158
|
+
|
|
159
|
+
```bash
|
|
160
|
+
# GET request
|
|
161
|
+
curl "http://localhost:3847/search?q=your+query&collection=my-project&limit=10"
|
|
162
|
+
|
|
163
|
+
# POST request with options
|
|
164
|
+
curl -X POST http://localhost:3847/search \
|
|
165
|
+
-H "Content-Type: application/json" \
|
|
166
|
+
-d '{"query": "your query", "collection": "my-project", "limit": 10}'
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
### Search Response
|
|
170
|
+
|
|
171
|
+
```json
|
|
172
|
+
{
|
|
173
|
+
"results": [
|
|
174
|
+
{
|
|
175
|
+
"id": "chunk-uuid",
|
|
176
|
+
"text": "The matched text content...",
|
|
177
|
+
"score": 0.89,
|
|
178
|
+
"vectorScore": 0.92,
|
|
179
|
+
"keywordScore": 0.85,
|
|
180
|
+
"sourceFile": "/path/to/file.aif-bin",
|
|
181
|
+
"chunkIndex": 0,
|
|
182
|
+
"metadata": {}
|
|
183
|
+
}
|
|
184
|
+
]
|
|
185
|
+
}
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
## Configuration
|
|
189
|
+
|
|
190
|
+
Configuration file location: `~/.aifbin-recall/config.yaml`
|
|
191
|
+
|
|
192
|
+
```yaml
|
|
193
|
+
server:
|
|
194
|
+
port: 3847
|
|
195
|
+
host: localhost
|
|
196
|
+
|
|
197
|
+
index:
|
|
198
|
+
path: ~/.aifbin-recall/index.db
|
|
199
|
+
|
|
200
|
+
search:
|
|
201
|
+
default_limit: 10
|
|
202
|
+
hybrid_weight: 0.7 # 0 = keywords only, 1 = vectors only
|
|
203
|
+
|
|
204
|
+
embedding:
|
|
205
|
+
model: minilm # Options: minilm, mpnet, bge-small, bge-base, e5-small
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
## Embedding Models
|
|
209
|
+
|
|
210
|
+
AIF-BIN Recall uses local sentence-transformer models for query embedding:
|
|
211
|
+
|
|
212
|
+
| Model | Dimensions | Speed | Quality |
|
|
213
|
+
|-------|-----------|-------|---------|
|
|
214
|
+
| `minilm` | 384 | Fastest | Good (default) |
|
|
215
|
+
| `mpnet` | 768 | Medium | Better |
|
|
216
|
+
| `bge-small` | 384 | Fast | Good |
|
|
217
|
+
| `bge-base` | 768 | Slower | Best |
|
|
218
|
+
| `e5-small` | 384 | Fast | Good |
|
|
219
|
+
|
|
220
|
+
Models are downloaded automatically on first use and cached locally.
|
|
221
|
+
|
|
222
|
+
## How It Works
|
|
223
|
+
|
|
224
|
+
1. **Indexing**: AIF-BIN Recall reads `.aif-bin` files (created by [AIF-BIN Pro](https://github.com/Terronex-dev/aifbin-pro)) and extracts their embedded vectors and text chunks into a local SQLite database.
|
|
225
|
+
|
|
226
|
+
2. **Search**: Queries are embedded using the same model, then matched against indexed vectors using cosine similarity. Optional BM25 keyword matching provides hybrid retrieval.
|
|
227
|
+
|
|
228
|
+
3. **Retrieval**: Results include the original text, metadata, source file, and similarity scores — ready for RAG pipelines or direct AI consumption.
|
|
229
|
+
|
|
230
|
+
## Part of the AIF-BIN Ecosystem
|
|
231
|
+
|
|
232
|
+
| Product | Description |
|
|
233
|
+
|---------|-------------|
|
|
234
|
+
| [AIF-BIN](https://github.com/Terronex-dev/aifbin) | Core specification and SDKs (Python, TypeScript, Rust, Go, C#, Java, Swift, Kotlin) |
|
|
235
|
+
| [AIF-BIN Lite](https://github.com/Terronex-dev/aifbin-lite) | Free CLI for basic .aif-bin file operations |
|
|
236
|
+
| [AIF-BIN Pro](https://github.com/Terronex-dev/aifbin-pro) | Professional CLI with AI extraction and batch processing |
|
|
237
|
+
| [AIF-BIN Recall](https://github.com/Terronex-dev/aifbin-recall) | Memory server for querying collections (you are here) |
|
|
238
|
+
| [Bot-BIN](https://github.com/Terronex-dev/bot-bin) | Persistent memory for AI chatbots |
|
|
239
|
+
|
|
240
|
+
## Contributing
|
|
241
|
+
|
|
242
|
+
Contributions are welcome! Please read our [Contributing Guidelines](CONTRIBUTING.md) before submitting a pull request.
|
|
243
|
+
|
|
244
|
+
## License
|
|
245
|
+
|
|
246
|
+
MIT © 2026 Terronex
|
|
247
|
+
|
|
248
|
+
## Trademarks
|
|
249
|
+
|
|
250
|
+
"AIF-BIN", "AIF-BIN Recall", "AIF-BIN Pro", and the Terronex name are trademarks of Terronex. The MIT license does not grant permission to use these trademarks. See NOTICE file for details.
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA;;GAEG"}
|
package/dist/cli.js
ADDED
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
/**
|
|
4
|
+
* AIF-BIN Recall CLI - Local-first memory server for AI agents
|
|
5
|
+
*/
|
|
6
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
7
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
8
|
+
};
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
const commander_1 = require("commander");
|
|
11
|
+
const path_1 = __importDefault(require("path"));
|
|
12
|
+
const os_1 = __importDefault(require("os"));
|
|
13
|
+
const fs_1 = __importDefault(require("fs"));
|
|
14
|
+
const db_js_1 = require("./db.js");
|
|
15
|
+
const search_js_1 = require("./search.js");
|
|
16
|
+
const indexer_js_1 = require("./indexer.js");
|
|
17
|
+
const server_js_1 = require("./server.js");
|
|
18
|
+
const mcp_js_1 = require("./mcp.js");
|
|
19
|
+
const types_js_1 = require("./types.js");
|
|
20
|
+
const embedder_js_1 = require("./embedder.js");
|
|
21
|
+
const program = new commander_1.Command();
|
|
22
|
+
// Resolve default DB path
|
|
23
|
+
function getDefaultDbPath() {
|
|
24
|
+
const configDir = path_1.default.join(os_1.default.homedir(), '.aifbin-recall');
|
|
25
|
+
if (!fs_1.default.existsSync(configDir)) {
|
|
26
|
+
fs_1.default.mkdirSync(configDir, { recursive: true });
|
|
27
|
+
}
|
|
28
|
+
return path_1.default.join(configDir, 'index.db');
|
|
29
|
+
}
|
|
30
|
+
program
|
|
31
|
+
.name('aifbin-recall')
|
|
32
|
+
.description('Local-first memory server for AI agents')
|
|
33
|
+
.version('0.1.0')
|
|
34
|
+
.option('-d, --db <path>', 'Database path', getDefaultDbPath());
|
|
35
|
+
// Index command
|
|
36
|
+
program
|
|
37
|
+
.command('index <directory>')
|
|
38
|
+
.description('Index AIF-BIN files from a directory')
|
|
39
|
+
.option('-c, --collection <name>', 'Collection name', 'default')
|
|
40
|
+
.option('-r, --recursive', 'Search subdirectories', true)
|
|
41
|
+
.option('--no-recursive', 'Do not search subdirectories')
|
|
42
|
+
.action((directory, options) => {
|
|
43
|
+
const dbPath = program.opts().db;
|
|
44
|
+
const db = new db_js_1.EngramDB(dbPath);
|
|
45
|
+
const indexer = new indexer_js_1.Indexer(db);
|
|
46
|
+
console.log(`Indexing ${directory} into collection "${options.collection}"...`);
|
|
47
|
+
const result = indexer.indexDirectory(path_1.default.resolve(directory), {
|
|
48
|
+
collection: options.collection,
|
|
49
|
+
recursive: options.recursive,
|
|
50
|
+
});
|
|
51
|
+
console.log(`\n✅ Indexed ${result.files} files (${result.chunks} chunks)`);
|
|
52
|
+
db.close();
|
|
53
|
+
});
|
|
54
|
+
// Serve command
|
|
55
|
+
program
|
|
56
|
+
.command('serve')
|
|
57
|
+
.description('Start the HTTP server')
|
|
58
|
+
.option('-p, --port <port>', 'Server port', String(types_js_1.DEFAULT_CONFIG.server.port))
|
|
59
|
+
.option('-h, --host <host>', 'Server host', types_js_1.DEFAULT_CONFIG.server.host)
|
|
60
|
+
.action((options) => {
|
|
61
|
+
const dbPath = program.opts().db;
|
|
62
|
+
const db = new db_js_1.EngramDB(dbPath);
|
|
63
|
+
(0, server_js_1.startServer)({
|
|
64
|
+
db,
|
|
65
|
+
config: {
|
|
66
|
+
port: parseInt(options.port, 10),
|
|
67
|
+
host: options.host,
|
|
68
|
+
},
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
// MCP command
|
|
72
|
+
program
|
|
73
|
+
.command('mcp')
|
|
74
|
+
.description('Start the MCP server for AI agent integration')
|
|
75
|
+
.action(async () => {
|
|
76
|
+
const dbPath = program.opts().db;
|
|
77
|
+
const db = new db_js_1.EngramDB(dbPath);
|
|
78
|
+
await (0, mcp_js_1.startMcpServer)(db);
|
|
79
|
+
});
|
|
80
|
+
// Collections command
|
|
81
|
+
program
|
|
82
|
+
.command('collections')
|
|
83
|
+
.description('List all collections')
|
|
84
|
+
.action(() => {
|
|
85
|
+
const dbPath = program.opts().db;
|
|
86
|
+
const db = new db_js_1.EngramDB(dbPath);
|
|
87
|
+
const collections = db.listCollections();
|
|
88
|
+
if (collections.length === 0) {
|
|
89
|
+
console.log('No collections found. Use "aifbin-recall index" to create one.');
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
console.log('Collections:\n');
|
|
93
|
+
for (const col of collections) {
|
|
94
|
+
console.log(` ${col.name}`);
|
|
95
|
+
console.log(` Files: ${col.fileCount}`);
|
|
96
|
+
console.log(` Chunks: ${col.chunkCount}`);
|
|
97
|
+
if (col.description) {
|
|
98
|
+
console.log(` Description: ${col.description}`);
|
|
99
|
+
}
|
|
100
|
+
console.log('');
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
db.close();
|
|
104
|
+
});
|
|
105
|
+
// Search command - now with built-in embedding!
|
|
106
|
+
program
|
|
107
|
+
.command('search <query>')
|
|
108
|
+
.description('Search memories using natural language')
|
|
109
|
+
.option('-c, --collection <name>', 'Collection to search')
|
|
110
|
+
.option('-n, --limit <count>', 'Number of results', '10')
|
|
111
|
+
.option('-m, --model <model>', 'Embedding model (minilm, mpnet, bge-small, bge-base, e5-small)', 'minilm')
|
|
112
|
+
.option('-e, --embedding <file>', 'JSON file containing pre-computed query embedding (optional)')
|
|
113
|
+
.action(async (query, options) => {
|
|
114
|
+
const dbPath = program.opts().db;
|
|
115
|
+
const db = new db_js_1.EngramDB(dbPath);
|
|
116
|
+
const search = new search_js_1.SearchEngine(db);
|
|
117
|
+
try {
|
|
118
|
+
let embedding;
|
|
119
|
+
if (options.embedding) {
|
|
120
|
+
// Use provided embedding file
|
|
121
|
+
const embeddingData = JSON.parse(fs_1.default.readFileSync(options.embedding, 'utf-8'));
|
|
122
|
+
embedding = embeddingData.embedding || embeddingData;
|
|
123
|
+
if (!Array.isArray(embedding)) {
|
|
124
|
+
console.error('Error: embedding must be an array');
|
|
125
|
+
db.close();
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
else {
|
|
130
|
+
// Generate embedding locally
|
|
131
|
+
console.log(`Embedding query with ${options.model}...`);
|
|
132
|
+
const embedder = new embedder_js_1.Embedder(options.model);
|
|
133
|
+
embedding = await embedder.embed(query);
|
|
134
|
+
console.log(`Embedding generated (${embedding.length} dims)\n`);
|
|
135
|
+
}
|
|
136
|
+
const results = await search.hybridSearch(embedding, query, {
|
|
137
|
+
collection: options.collection,
|
|
138
|
+
limit: parseInt(options.limit, 10),
|
|
139
|
+
});
|
|
140
|
+
if (results.length === 0) {
|
|
141
|
+
console.log('No results found.');
|
|
142
|
+
}
|
|
143
|
+
else {
|
|
144
|
+
console.log(`Found ${results.length} results:\n`);
|
|
145
|
+
for (const [i, r] of results.entries()) {
|
|
146
|
+
console.log(`[${i + 1}] Score: ${r.score.toFixed(4)} (vector: ${r.vectorScore.toFixed(4)}, keyword: ${r.keywordScore?.toFixed(4) || 'n/a'})`);
|
|
147
|
+
console.log(` Source: ${path_1.default.basename(r.chunk.sourceFile)}`);
|
|
148
|
+
console.log(` Text: ${r.chunk.text.slice(0, 200)}${r.chunk.text.length > 200 ? '...' : ''}`);
|
|
149
|
+
console.log('');
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
catch (err) {
|
|
154
|
+
console.error('Error:', err);
|
|
155
|
+
}
|
|
156
|
+
db.close();
|
|
157
|
+
});
|
|
158
|
+
// Info command
|
|
159
|
+
program
|
|
160
|
+
.command('info')
|
|
161
|
+
.description('Show database information')
|
|
162
|
+
.action(() => {
|
|
163
|
+
const dbPath = program.opts().db;
|
|
164
|
+
console.log(`AIF-BIN Recall v0.1.0`);
|
|
165
|
+
console.log(`Database: ${dbPath}`);
|
|
166
|
+
console.log('');
|
|
167
|
+
if (fs_1.default.existsSync(dbPath)) {
|
|
168
|
+
const db = new db_js_1.EngramDB(dbPath);
|
|
169
|
+
const collections = db.listCollections();
|
|
170
|
+
const totalChunks = collections.reduce((sum, c) => sum + c.chunkCount, 0);
|
|
171
|
+
const totalFiles = collections.reduce((sum, c) => sum + c.fileCount, 0);
|
|
172
|
+
console.log(`Collections: ${collections.length}`);
|
|
173
|
+
console.log(`Total files: ${totalFiles}`);
|
|
174
|
+
console.log(`Total chunks: ${totalChunks}`);
|
|
175
|
+
db.close();
|
|
176
|
+
}
|
|
177
|
+
else {
|
|
178
|
+
console.log('Database not found. Run "aifbin-recall index" to create one.');
|
|
179
|
+
}
|
|
180
|
+
});
|
|
181
|
+
program.parse();
|
|
182
|
+
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";;AACA;;GAEG;;;;;AAEH,yCAAoC;AACpC,gDAAwB;AACxB,4CAAoB;AACpB,4CAAoB;AACpB,mCAAmC;AACnC,2CAA2C;AAC3C,6CAAuC;AACvC,2CAA0C;AAC1C,qCAA0C;AAC1C,yCAA4C;AAC5C,+CAAoF;AAEpF,MAAM,OAAO,GAAG,IAAI,mBAAO,EAAE,CAAC;AAE9B,0BAA0B;AAC1B,SAAS,gBAAgB;IACvB,MAAM,SAAS,GAAG,cAAI,CAAC,IAAI,CAAC,YAAE,CAAC,OAAO,EAAE,EAAE,gBAAgB,CAAC,CAAC;IAC5D,IAAI,CAAC,YAAE,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;QAC9B,YAAE,CAAC,SAAS,CAAC,SAAS,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAC/C,CAAC;IACD,OAAO,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;AAC1C,CAAC;AAED,OAAO;KACJ,IAAI,CAAC,eAAe,CAAC;KACrB,WAAW,CAAC,yCAAyC,CAAC;KACtD,OAAO,CAAC,OAAO,CAA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AAG,EAAE,CAAC,eAAe,EAAE,CAAC;QACzC,MAAM,WAAW,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG,CAAC,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC;QAC1E,MAAM,UAAU,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC;QAExE,OAAO,CAAC,GAAG,CAAC,gBAAgB,WAAW,CAAC,MAAM,EAAE,CAAC,CAAC;QAClD,OAAO,CAAC,GAAG,CAAC,gBAAgB,UAAU,EAAE,CAAC,CAAC;QAC1C,OAAO,CAAC,GAAG,CAAC,iBAAiB,WAAW,EAAE,CAAC,CAAC;QAC5C,EAAE,CAAC,KAAK,EAAE,CAAC;IACb,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,GAAG,CAAC,8DAA8D,CAAC,CAAC;IAC9E,CAAC;AACH,CAAC,CAAC,CAAC;AAEL,OAAO,CAAC,KAAK,EAAE,CAAC"}
|
package/dist/db.d.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SQLite database management for AIF-BIN Recall
|
|
3
|
+
*/
|
|
4
|
+
import { type Collection, type MemoryChunk } from './types.js';
|
|
5
|
+
export declare class EngramDB {
|
|
6
|
+
private db;
|
|
7
|
+
constructor(dbPath?: string);
|
|
8
|
+
private resolvePath;
|
|
9
|
+
private init;
|
|
10
|
+
createCollection(name: string, description?: string): Collection;
|
|
11
|
+
getCollection(name: string): Collection | null;
|
|
12
|
+
getCollectionById(id: string): Collection | null;
|
|
13
|
+
listCollections(): Collection[];
|
|
14
|
+
deleteCollection(name: string): boolean;
|
|
15
|
+
insertChunk(chunk: Omit<MemoryChunk, 'createdAt' | 'updatedAt'>): void;
|
|
16
|
+
insertChunks(chunks: Omit<MemoryChunk, 'createdAt' | 'updatedAt'>[]): void;
|
|
17
|
+
getChunk(id: string): MemoryChunk | null;
|
|
18
|
+
getChunksByCollection(collectionId: string): MemoryChunk[];
|
|
19
|
+
deleteChunksBySource(sourceFile: string): number;
|
|
20
|
+
getAllChunksWithEmbeddings(collectionId?: string): MemoryChunk[];
|
|
21
|
+
keywordSearch(query: string, collectionId?: string, limit?: number): {
|
|
22
|
+
id: string;
|
|
23
|
+
score: number;
|
|
24
|
+
}[];
|
|
25
|
+
updateCollectionStats(collectionId: string): void;
|
|
26
|
+
private rowToChunk;
|
|
27
|
+
close(): void;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=db.d.ts.map
|
package/dist/db.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"db.d.ts","sourceRoot":"","sources":["../src/db.ts"],"names":[],"mappings":"AAAA;;GAEG;AAMH,OAAO,EAAkB,KAAK,UAAU,EAAE,KAAK,WAAW,EAAqB,MAAM,YAAY,CAAC;AAElG,qBAAa,QAAQ;IACnB,OAAO,CAAC,EAAE,CAAoB;gBAElB,MAAM,CAAC,EAAE,MAAM;IAa3B,OAAO,CAAC,WAAW;IAOnB,OAAO,CAAC,IAAI;IAoEZ,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,UAAU;IAUhE,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,GAAG,IAAI;IAe9C,iBAAiB,CAAC,EAAE,EAAE,MAAM,GAAG,UAAU,GAAG,IAAI;IAehD,eAAe,IAAI,UAAU,EAAE;IAc/B,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAOvC,WAAW,CAAC,KAAK,EAAE,IAAI,CAAC,WAAW,EAAE,WAAW,GAAG,WAAW,CAAC,GAAG,IAAI;IAoBtE,YAAY,CAAC,MAAM,EAAE,IAAI,CAAC,WAAW,EAAE,WAAW,GAAG,WAAW,CAAC,EAAE,GAA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