@alextis59/athena 1.2.0 → 1.3.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/README.md +5 -4
- package/dist/parsers/pdf2llm.d.ts +2 -2
- package/dist/parsers/pdf2llm.js +1 -1
- package/package.json +5 -4
- package/docs/QUALITY.md +0 -137
- package/docs/SECURITY.md +0 -140
- package/docs/adr/0001-sqlite-driver.md +0 -23
- package/docs/agentic-rag-specifications.md +0 -670
- package/docs/agentic-rag-study.md +0 -1056
- package/docs/exec-plans/template.md +0 -67
- package/docs/implementation-plan.md +0 -1433
- package/docs/index.md +0 -61
- package/docs/mcp-integration.md +0 -227
- package/docs/tech-debt-tracker.md +0 -21
- package/docs/validation-corpus.md +0 -71
|
@@ -1,670 +0,0 @@
|
|
|
1
|
-
# Agentic RAG Tool Specifications
|
|
2
|
-
|
|
3
|
-
Date: 2026-07-03
|
|
4
|
-
|
|
5
|
-
Related study: [Agentic RAG Tool Design Study](./agentic-rag-study.md)
|
|
6
|
-
|
|
7
|
-
## Purpose
|
|
8
|
-
|
|
9
|
-
Athena is a local-first documentation RAG tool. It indexes documentation in the
|
|
10
|
-
current folder, launches a local chat UI, and answers questions with exact
|
|
11
|
-
citations into the original sources.
|
|
12
|
-
|
|
13
|
-
This specification converts the study into concrete product and engineering
|
|
14
|
-
requirements.
|
|
15
|
-
|
|
16
|
-
## Naming
|
|
17
|
-
|
|
18
|
-
- Project name: `athena`.
|
|
19
|
-
- npm package name: `@alextis59/athena`.
|
|
20
|
-
- CLI binary/command name: `athena`.
|
|
21
|
-
- Package-run form: `npx @alextis59/athena`.
|
|
22
|
-
- Local cache directory: `.athena/`.
|
|
23
|
-
|
|
24
|
-
All product documentation and command examples should treat `athena` as the
|
|
25
|
-
canonical project and command name. `npx @alextis59/athena` is only the
|
|
26
|
-
no-install npm invocation form.
|
|
27
|
-
|
|
28
|
-
## Final Architecture Decisions
|
|
29
|
-
|
|
30
|
-
1. Athena owns the agentic loop.
|
|
31
|
-
No agent SDK handles tool selection, tool execution, step control, memory
|
|
32
|
-
policy, streaming, or citation validation.
|
|
33
|
-
|
|
34
|
-
2. `pdf-2-llm` is the canonical PDF parser.
|
|
35
|
-
PDF ingestion uses the published npm package `pdf-2-llm`, not a local
|
|
36
|
-
workspace-only dependency.
|
|
37
|
-
|
|
38
|
-
3. Local-first is the default.
|
|
39
|
-
Indexes, embeddings, and chat UI should run locally unless the user
|
|
40
|
-
explicitly opts into remote model or embedding providers.
|
|
41
|
-
|
|
42
|
-
4. Citations are first-class data.
|
|
43
|
-
Every substantive answer must be grounded in source ranges or PDF page
|
|
44
|
-
regions that the UI can open.
|
|
45
|
-
|
|
46
|
-
5. External agents are integrations.
|
|
47
|
-
OpenCode, MCP clients, LangChain, LlamaIndex, Vercel AI SDK, and similar
|
|
48
|
-
tools may integrate with Athena, but none of them should own Athena's core
|
|
49
|
-
agent behavior.
|
|
50
|
-
|
|
51
|
-
## Functional Requirements
|
|
52
|
-
|
|
53
|
-
### FR-1: Single Command Startup
|
|
54
|
-
|
|
55
|
-
Athena must support a command that can be run inside any documentation folder:
|
|
56
|
-
|
|
57
|
-
```bash
|
|
58
|
-
athena
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
For ad hoc execution without installing the binary first, users may run
|
|
62
|
-
`npx @alextis59/athena`.
|
|
63
|
-
|
|
64
|
-
The command must:
|
|
65
|
-
|
|
66
|
-
- discover supported documentation files;
|
|
67
|
-
- create or update a local `.athena/index.sqlite` cache;
|
|
68
|
-
- skip unchanged files;
|
|
69
|
-
- start a local web UI;
|
|
70
|
-
- expose a chat interface connected to the local index.
|
|
71
|
-
|
|
72
|
-
### FR-2: Index-Only Mode
|
|
73
|
-
|
|
74
|
-
Athena must support indexing without starting the UI:
|
|
75
|
-
|
|
76
|
-
```bash
|
|
77
|
-
athena index
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
This command must exit non-zero when parsing, database migration, or embedding
|
|
81
|
-
generation fails.
|
|
82
|
-
|
|
83
|
-
### FR-3: Serve Existing Index
|
|
84
|
-
|
|
85
|
-
Athena must support serving a previously built index:
|
|
86
|
-
|
|
87
|
-
```bash
|
|
88
|
-
athena serve
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
If the index is missing, the command should either fail with a clear message or
|
|
92
|
-
offer an explicit `--build` mode.
|
|
93
|
-
|
|
94
|
-
### FR-4: One-Shot Ask Mode
|
|
95
|
-
|
|
96
|
-
Athena should support terminal questions:
|
|
97
|
-
|
|
98
|
-
```bash
|
|
99
|
-
athena ask "How do I configure OAuth?"
|
|
100
|
-
```
|
|
101
|
-
|
|
102
|
-
The answer must include citations in terminal-readable form.
|
|
103
|
-
|
|
104
|
-
### FR-5: Doctor Mode
|
|
105
|
-
|
|
106
|
-
Athena should expose a diagnostic command:
|
|
107
|
-
|
|
108
|
-
```bash
|
|
109
|
-
athena doctor
|
|
110
|
-
```
|
|
111
|
-
|
|
112
|
-
It should report:
|
|
113
|
-
|
|
114
|
-
- database status;
|
|
115
|
-
- schema version;
|
|
116
|
-
- indexed source count;
|
|
117
|
-
- embedding provider status;
|
|
118
|
-
- `pdf-2-llm` package availability;
|
|
119
|
-
- parser warnings summary;
|
|
120
|
-
- model cache status;
|
|
121
|
-
- UI port availability.
|
|
122
|
-
|
|
123
|
-
### FR-6: MCP Server Mode
|
|
124
|
-
|
|
125
|
-
Athena should expose an optional MCP server:
|
|
126
|
-
|
|
127
|
-
```bash
|
|
128
|
-
athena mcp
|
|
129
|
-
```
|
|
130
|
-
|
|
131
|
-
The MCP server must expose citation-aware retrieval tools only. It must not
|
|
132
|
-
allow external agents to bypass Athena's source validation.
|
|
133
|
-
|
|
134
|
-
## Supported Inputs
|
|
135
|
-
|
|
136
|
-
### Initial File Types
|
|
137
|
-
|
|
138
|
-
Athena must support:
|
|
139
|
-
|
|
140
|
-
- Markdown: `.md`, `.mdx`;
|
|
141
|
-
- text: `.txt`;
|
|
142
|
-
- reStructuredText: `.rst`;
|
|
143
|
-
- AsciiDoc: `.adoc`;
|
|
144
|
-
- HTML: `.html`, `.htm`;
|
|
145
|
-
- PDF: `.pdf`;
|
|
146
|
-
- extensionless documentation files such as `README`, `CHANGELOG`,
|
|
147
|
-
`CONTRIBUTING`, and `LICENSE`.
|
|
148
|
-
|
|
149
|
-
### Default Exclusions
|
|
150
|
-
|
|
151
|
-
Athena must exclude:
|
|
152
|
-
|
|
153
|
-
- `.git/**`;
|
|
154
|
-
- `node_modules/**`;
|
|
155
|
-
- `.athena/**`;
|
|
156
|
-
- `dist/**`;
|
|
157
|
-
- `build/**`;
|
|
158
|
-
- `coverage/**`;
|
|
159
|
-
- binary files not explicitly supported.
|
|
160
|
-
|
|
161
|
-
## Configuration
|
|
162
|
-
|
|
163
|
-
Athena should load optional config from:
|
|
164
|
-
|
|
165
|
-
- `athena.config.ts`;
|
|
166
|
-
- `athena.config.mjs`;
|
|
167
|
-
- `athena.config.json`.
|
|
168
|
-
|
|
169
|
-
Example:
|
|
170
|
-
|
|
171
|
-
```ts
|
|
172
|
-
import { defineConfig } from "@alextis59/athena";
|
|
173
|
-
|
|
174
|
-
export default defineConfig({
|
|
175
|
-
index: {
|
|
176
|
-
include: ["**/*.md", "**/*.mdx", "**/*.pdf", "**/*.html"],
|
|
177
|
-
exclude: ["node_modules/**", "dist/**", ".git/**"]
|
|
178
|
-
},
|
|
179
|
-
embeddings: {
|
|
180
|
-
provider: "transformers-js",
|
|
181
|
-
model: "mixedbread-ai/mxbai-embed-xsmall-v1",
|
|
182
|
-
dimensions: 384,
|
|
183
|
-
pooling: "mean",
|
|
184
|
-
normalize: true
|
|
185
|
-
},
|
|
186
|
-
agent: {
|
|
187
|
-
provider: "opencode"
|
|
188
|
-
},
|
|
189
|
-
pdf: {
|
|
190
|
-
parser: "pdf-2-llm",
|
|
191
|
-
pageAnchors: true,
|
|
192
|
-
csvSidecars: true,
|
|
193
|
-
timeoutMs: 30_000,
|
|
194
|
-
minConfidenceForAutoCitation: 0.65
|
|
195
|
-
},
|
|
196
|
-
server: {
|
|
197
|
-
host: "127.0.0.1",
|
|
198
|
-
port: 4317
|
|
199
|
-
}
|
|
200
|
-
});
|
|
201
|
-
```
|
|
202
|
-
|
|
203
|
-
## PDF Ingestion Specification
|
|
204
|
-
|
|
205
|
-
### Package
|
|
206
|
-
|
|
207
|
-
Athena must use the public npm package:
|
|
208
|
-
|
|
209
|
-
```bash
|
|
210
|
-
npm install pdf-2-llm
|
|
211
|
-
```
|
|
212
|
-
|
|
213
|
-
The Node parser import should use:
|
|
214
|
-
|
|
215
|
-
```ts
|
|
216
|
-
import { convertPdfToMarkdown } from "pdf-2-llm/node";
|
|
217
|
-
```
|
|
218
|
-
|
|
219
|
-
### PDF Parser Output
|
|
220
|
-
|
|
221
|
-
Athena must preserve these `pdf-2-llm` outputs when available:
|
|
222
|
-
|
|
223
|
-
- Markdown;
|
|
224
|
-
- source-map entries;
|
|
225
|
-
- page regions;
|
|
226
|
-
- document IR;
|
|
227
|
-
- table sidecars;
|
|
228
|
-
- extracted assets;
|
|
229
|
-
- warning codes;
|
|
230
|
-
- diagnostics;
|
|
231
|
-
- confidence scores.
|
|
232
|
-
|
|
233
|
-
### PDF Storage Requirements
|
|
234
|
-
|
|
235
|
-
For every parsed PDF, Athena must store:
|
|
236
|
-
|
|
237
|
-
- original file path;
|
|
238
|
-
- source hash;
|
|
239
|
-
- parser package version;
|
|
240
|
-
- parser options hash;
|
|
241
|
-
- generated Markdown;
|
|
242
|
-
- source-map metadata;
|
|
243
|
-
- document IR metadata;
|
|
244
|
-
- warning summary;
|
|
245
|
-
- confidence summary;
|
|
246
|
-
- sidecar asset references.
|
|
247
|
-
|
|
248
|
-
### PDF Citation Requirements
|
|
249
|
-
|
|
250
|
-
PDF citations must include:
|
|
251
|
-
|
|
252
|
-
- source file path;
|
|
253
|
-
- page number;
|
|
254
|
-
- page region coordinates when available;
|
|
255
|
-
- generated Markdown offset or line range;
|
|
256
|
-
- confidence score when available;
|
|
257
|
-
- warning codes that affect the cited region.
|
|
258
|
-
|
|
259
|
-
Example:
|
|
260
|
-
|
|
261
|
-
```json
|
|
262
|
-
{
|
|
263
|
-
"kind": "pdf",
|
|
264
|
-
"path": "manual.pdf",
|
|
265
|
-
"page": 17,
|
|
266
|
-
"regions": [
|
|
267
|
-
{ "x": 72, "y": 144, "width": 440, "height": 88 }
|
|
268
|
-
],
|
|
269
|
-
"markdownOffsetStart": 1204,
|
|
270
|
-
"markdownOffsetEnd": 1422,
|
|
271
|
-
"confidence": 0.91,
|
|
272
|
-
"warningCodes": []
|
|
273
|
-
}
|
|
274
|
-
```
|
|
275
|
-
|
|
276
|
-
### PDF Warning Behavior
|
|
277
|
-
|
|
278
|
-
Athena must not silently hide extraction uncertainty.
|
|
279
|
-
|
|
280
|
-
If a cited PDF region has warnings or low confidence, the UI should display that
|
|
281
|
-
state near the citation.
|
|
282
|
-
|
|
283
|
-
If confidence is below the configured auto-citation threshold, Athena should
|
|
284
|
-
either avoid using that chunk as evidence or mark the citation as uncertain.
|
|
285
|
-
|
|
286
|
-
## Agent Loop Specification
|
|
287
|
-
|
|
288
|
-
### Ownership
|
|
289
|
-
|
|
290
|
-
Athena must implement its own agent loop. No SDK should own the loop.
|
|
291
|
-
|
|
292
|
-
The loop must be responsible for:
|
|
293
|
-
|
|
294
|
-
- building model messages;
|
|
295
|
-
- exposing tool schemas;
|
|
296
|
-
- receiving tool calls;
|
|
297
|
-
- validating tool call inputs;
|
|
298
|
-
- executing tools;
|
|
299
|
-
- appending tool results;
|
|
300
|
-
- enforcing max steps;
|
|
301
|
-
- streaming partial output;
|
|
302
|
-
- compacting conversation state;
|
|
303
|
-
- validating final citations.
|
|
304
|
-
|
|
305
|
-
### Model Provider Interface
|
|
306
|
-
|
|
307
|
-
Model providers must be adapters behind a small interface:
|
|
308
|
-
|
|
309
|
-
```ts
|
|
310
|
-
export interface ModelProvider {
|
|
311
|
-
streamResponse(input: {
|
|
312
|
-
model: string;
|
|
313
|
-
messages: ModelMessage[];
|
|
314
|
-
tools: ToolDef[];
|
|
315
|
-
temperature?: number;
|
|
316
|
-
}): AsyncIterable<ModelEvent>;
|
|
317
|
-
}
|
|
318
|
-
```
|
|
319
|
-
|
|
320
|
-
Provider adapters may use vendor SDKs internally if useful, but those SDKs must
|
|
321
|
-
not own Athena's agent loop.
|
|
322
|
-
|
|
323
|
-
### External Agent Provider
|
|
324
|
-
|
|
325
|
-
OpenCode should remain the default external-agent provider for MCP setup.
|
|
326
|
-
Athena should also allow `codex` through `agent.provider` and the
|
|
327
|
-
`--agent-provider` CLI option. This setting is client-specific setup guidance
|
|
328
|
-
only; it must not replace Athena's loop, weaken citation validation, or expose
|
|
329
|
-
additional MCP tools.
|
|
330
|
-
|
|
331
|
-
### Step Limit
|
|
332
|
-
|
|
333
|
-
The default max step count should be 6.
|
|
334
|
-
|
|
335
|
-
If the model exceeds the limit, Athena must stop the turn and return a clear
|
|
336
|
-
message that the answer could not be completed within the tool budget.
|
|
337
|
-
|
|
338
|
-
### Citation Validation
|
|
339
|
-
|
|
340
|
-
Before finalizing an answer, Athena must validate that cited claims reference
|
|
341
|
-
retrieved source ranges or PDF regions.
|
|
342
|
-
|
|
343
|
-
The validator must reject:
|
|
344
|
-
|
|
345
|
-
- citations pointing to unknown paths;
|
|
346
|
-
- line ranges outside file bounds;
|
|
347
|
-
- PDF page numbers outside the document;
|
|
348
|
-
- PDF regions missing source-map backing when source-map backing is required;
|
|
349
|
-
- citations to chunks that were not retrieved or read during the turn.
|
|
350
|
-
|
|
351
|
-
## Agent Tools
|
|
352
|
-
|
|
353
|
-
### `searchDocs`
|
|
354
|
-
|
|
355
|
-
Hybrid search over indexed documentation.
|
|
356
|
-
|
|
357
|
-
Input:
|
|
358
|
-
|
|
359
|
-
```json
|
|
360
|
-
{
|
|
361
|
-
"query": "string",
|
|
362
|
-
"filters": {
|
|
363
|
-
"pathPrefix": "string",
|
|
364
|
-
"kind": "markdown | pdf | html | text"
|
|
365
|
-
},
|
|
366
|
-
"limit": 10
|
|
367
|
-
}
|
|
368
|
-
```
|
|
369
|
-
|
|
370
|
-
Output:
|
|
371
|
-
|
|
372
|
-
```json
|
|
373
|
-
{
|
|
374
|
-
"results": [
|
|
375
|
-
{
|
|
376
|
-
"chunkId": 123,
|
|
377
|
-
"path": "docs/api.md",
|
|
378
|
-
"headingPath": "Authentication > Tokens",
|
|
379
|
-
"snippet": "...",
|
|
380
|
-
"score": 0.82,
|
|
381
|
-
"locator": { "startLine": 10, "endLine": 22 }
|
|
382
|
-
}
|
|
383
|
-
]
|
|
384
|
-
}
|
|
385
|
-
```
|
|
386
|
-
|
|
387
|
-
### `readSourceRange`
|
|
388
|
-
|
|
389
|
-
Read an exact text-like source range.
|
|
390
|
-
|
|
391
|
-
Input:
|
|
392
|
-
|
|
393
|
-
```json
|
|
394
|
-
{
|
|
395
|
-
"path": "docs/api.md",
|
|
396
|
-
"startLine": 10,
|
|
397
|
-
"endLine": 40
|
|
398
|
-
}
|
|
399
|
-
```
|
|
400
|
-
|
|
401
|
-
### `readPdfSource`
|
|
402
|
-
|
|
403
|
-
Read converted PDF content and source-map metadata.
|
|
404
|
-
|
|
405
|
-
Input:
|
|
406
|
-
|
|
407
|
-
```json
|
|
408
|
-
{
|
|
409
|
-
"path": "manual.pdf",
|
|
410
|
-
"page": 17,
|
|
411
|
-
"regionId": "..."
|
|
412
|
-
}
|
|
413
|
-
```
|
|
414
|
-
|
|
415
|
-
### `grepDocs`
|
|
416
|
-
|
|
417
|
-
Exact string or regex search.
|
|
418
|
-
|
|
419
|
-
Input:
|
|
420
|
-
|
|
421
|
-
```json
|
|
422
|
-
{
|
|
423
|
-
"pattern": "AUTH_TOKEN",
|
|
424
|
-
"caseSensitive": false,
|
|
425
|
-
"limit": 20
|
|
426
|
-
}
|
|
427
|
-
```
|
|
428
|
-
|
|
429
|
-
### `listDocs`
|
|
430
|
-
|
|
431
|
-
Inspect indexed sources.
|
|
432
|
-
|
|
433
|
-
Input:
|
|
434
|
-
|
|
435
|
-
```json
|
|
436
|
-
{
|
|
437
|
-
"pathPrefix": "docs/",
|
|
438
|
-
"kind": "pdf"
|
|
439
|
-
}
|
|
440
|
-
```
|
|
441
|
-
|
|
442
|
-
### `relatedChunks`
|
|
443
|
-
|
|
444
|
-
Fetch neighboring chunks.
|
|
445
|
-
|
|
446
|
-
Input:
|
|
447
|
-
|
|
448
|
-
```json
|
|
449
|
-
{
|
|
450
|
-
"chunkId": 123,
|
|
451
|
-
"before": 1,
|
|
452
|
-
"after": 2
|
|
453
|
-
}
|
|
454
|
-
```
|
|
455
|
-
|
|
456
|
-
## Retrieval Specification
|
|
457
|
-
|
|
458
|
-
Athena must support hybrid retrieval:
|
|
459
|
-
|
|
460
|
-
1. lexical search with SQLite FTS5;
|
|
461
|
-
2. semantic vector search;
|
|
462
|
-
3. exact grep for identifiers;
|
|
463
|
-
4. result merging and deduplication;
|
|
464
|
-
5. optional reranking;
|
|
465
|
-
6. neighboring context expansion;
|
|
466
|
-
7. warning/confidence-aware PDF scoring.
|
|
467
|
-
|
|
468
|
-
Ranking should boost:
|
|
469
|
-
|
|
470
|
-
- exact identifier matches;
|
|
471
|
-
- heading matches;
|
|
472
|
-
- source title matches;
|
|
473
|
-
- recently read related chunks;
|
|
474
|
-
- high-confidence PDF regions.
|
|
475
|
-
|
|
476
|
-
Ranking should penalize:
|
|
477
|
-
|
|
478
|
-
- low-confidence PDF regions;
|
|
479
|
-
- chunks with parser warnings;
|
|
480
|
-
- overly large generic chunks;
|
|
481
|
-
- stale chunks from superseded parser/index versions.
|
|
482
|
-
|
|
483
|
-
## Embeddings Specification
|
|
484
|
-
|
|
485
|
-
### Default Provider
|
|
486
|
-
|
|
487
|
-
The default embedding provider should be local:
|
|
488
|
-
|
|
489
|
-
```yaml
|
|
490
|
-
provider: transformers-js
|
|
491
|
-
model: mixedbread-ai/mxbai-embed-xsmall-v1
|
|
492
|
-
dimensions: 384
|
|
493
|
-
pooling: mean
|
|
494
|
-
normalize: true
|
|
495
|
-
```
|
|
496
|
-
|
|
497
|
-
### Optional Providers
|
|
498
|
-
|
|
499
|
-
Athena should support provider adapters for:
|
|
500
|
-
|
|
501
|
-
- Ollama;
|
|
502
|
-
- OpenAI;
|
|
503
|
-
- Voyage;
|
|
504
|
-
- Cohere;
|
|
505
|
-
- Gemini.
|
|
506
|
-
|
|
507
|
-
Remote providers must require explicit user opt-in before document text is sent
|
|
508
|
-
over the network.
|
|
509
|
-
|
|
510
|
-
### Cache Keys
|
|
511
|
-
|
|
512
|
-
Embedding cache keys must include:
|
|
513
|
-
|
|
514
|
-
- chunk text hash;
|
|
515
|
-
- provider name;
|
|
516
|
-
- model name;
|
|
517
|
-
- dimensions;
|
|
518
|
-
- pooling;
|
|
519
|
-
- normalization;
|
|
520
|
-
- quantization settings;
|
|
521
|
-
- model revision or digest when available;
|
|
522
|
-
- chunking strategy version.
|
|
523
|
-
|
|
524
|
-
## Storage Specification
|
|
525
|
-
|
|
526
|
-
Athena must store index state in `.athena/index.sqlite`.
|
|
527
|
-
|
|
528
|
-
Required tables:
|
|
529
|
-
|
|
530
|
-
- `sources`;
|
|
531
|
-
- `documents`;
|
|
532
|
-
- `chunks`;
|
|
533
|
-
- `chunks_fts`;
|
|
534
|
-
- `embeddings`;
|
|
535
|
-
- `runs`;
|
|
536
|
-
- `parser_artifacts`;
|
|
537
|
-
- `conversation_turns`;
|
|
538
|
-
- `answer_citations`.
|
|
539
|
-
|
|
540
|
-
The schema must be migration-based and versioned.
|
|
541
|
-
|
|
542
|
-
Source records must include:
|
|
543
|
-
|
|
544
|
-
- path;
|
|
545
|
-
- file kind;
|
|
546
|
-
- hash;
|
|
547
|
-
- file size;
|
|
548
|
-
- mtime;
|
|
549
|
-
- parser name;
|
|
550
|
-
- parser version;
|
|
551
|
-
- parser options hash;
|
|
552
|
-
- indexed timestamp.
|
|
553
|
-
|
|
554
|
-
Chunk records must include:
|
|
555
|
-
|
|
556
|
-
- source ID;
|
|
557
|
-
- document ID;
|
|
558
|
-
- ordinal;
|
|
559
|
-
- heading path;
|
|
560
|
-
- text;
|
|
561
|
-
- normalized text;
|
|
562
|
-
- token estimate;
|
|
563
|
-
- locator JSON;
|
|
564
|
-
- extraction confidence;
|
|
565
|
-
- warning codes.
|
|
566
|
-
|
|
567
|
-
## Chat UI Specification
|
|
568
|
-
|
|
569
|
-
The local UI must include:
|
|
570
|
-
|
|
571
|
-
- chat panel;
|
|
572
|
-
- source citation list;
|
|
573
|
-
- source preview panel;
|
|
574
|
-
- retrieval trace drawer;
|
|
575
|
-
- index status indicator;
|
|
576
|
-
- parser warning badges;
|
|
577
|
-
- source filter controls.
|
|
578
|
-
|
|
579
|
-
Citation interactions:
|
|
580
|
-
|
|
581
|
-
- text citations open exact line ranges;
|
|
582
|
-
- PDF citations open generated Markdown and PDF page-region metadata;
|
|
583
|
-
- uncertain citations show warning/confidence state;
|
|
584
|
-
- copied answers preserve citation labels.
|
|
585
|
-
|
|
586
|
-
## Follow-Up Memory Specification
|
|
587
|
-
|
|
588
|
-
Athena should persist compact conversation memory:
|
|
589
|
-
|
|
590
|
-
- user question;
|
|
591
|
-
- final answer summary;
|
|
592
|
-
- citations;
|
|
593
|
-
- timestamp;
|
|
594
|
-
- optional user-pinned sources.
|
|
595
|
-
|
|
596
|
-
Athena should not replay full intermediate tool traces into future model context
|
|
597
|
-
unless the user asks for debug/audit details.
|
|
598
|
-
|
|
599
|
-
## Security and Privacy
|
|
600
|
-
|
|
601
|
-
Defaults:
|
|
602
|
-
|
|
603
|
-
- bind the UI to `127.0.0.1`;
|
|
604
|
-
- store indexes locally;
|
|
605
|
-
- use local embeddings;
|
|
606
|
-
- avoid remote document upload;
|
|
607
|
-
- avoid automatic external agent execution.
|
|
608
|
-
|
|
609
|
-
Remote model or embedding providers must require explicit configuration.
|
|
610
|
-
|
|
611
|
-
MCP mode must be read-only by default.
|
|
612
|
-
|
|
613
|
-
## MVP Acceptance Criteria
|
|
614
|
-
|
|
615
|
-
### MVP-1: Markdown RAG
|
|
616
|
-
|
|
617
|
-
Done when:
|
|
618
|
-
|
|
619
|
-
- `athena index` indexes Markdown files;
|
|
620
|
-
- unchanged files are skipped on the second run;
|
|
621
|
-
- `athena serve` starts a local UI;
|
|
622
|
-
- a question can be answered from Markdown;
|
|
623
|
-
- answer citations open exact line ranges.
|
|
624
|
-
|
|
625
|
-
### MVP-2: Local Embeddings
|
|
626
|
-
|
|
627
|
-
Done when:
|
|
628
|
-
|
|
629
|
-
- default local embeddings are generated;
|
|
630
|
-
- vectors are cached;
|
|
631
|
-
- lexical and vector search are merged;
|
|
632
|
-
- changing the embedding model invalidates only affected vectors.
|
|
633
|
-
|
|
634
|
-
### MVP-3: PDF RAG
|
|
635
|
-
|
|
636
|
-
Done when:
|
|
637
|
-
|
|
638
|
-
- `pdf-2-llm` is installed from npm;
|
|
639
|
-
- PDFs are converted through `pdf-2-llm/node`;
|
|
640
|
-
- generated Markdown and source maps are stored;
|
|
641
|
-
- PDF citations include page and region metadata;
|
|
642
|
-
- low-confidence regions are visible in the UI.
|
|
643
|
-
|
|
644
|
-
### MVP-4: Agent Loop
|
|
645
|
-
|
|
646
|
-
Done when:
|
|
647
|
-
|
|
648
|
-
- the custom loop can call tools for up to a configured max step count;
|
|
649
|
-
- no agent SDK controls tool execution;
|
|
650
|
-
- invalid tool inputs are rejected;
|
|
651
|
-
- final answer citation validation runs every turn;
|
|
652
|
-
- unsupported answers are refused or marked as unsupported.
|
|
653
|
-
|
|
654
|
-
### MVP-5: Evaluation Harness
|
|
655
|
-
|
|
656
|
-
Done when:
|
|
657
|
-
|
|
658
|
-
- parser/index tests run locally;
|
|
659
|
-
- retrieval tests compare FTS-only, vector-only, and hybrid results;
|
|
660
|
-
- answer tests validate citation requirements;
|
|
661
|
-
- PDF source-map tests verify page and region locators.
|
|
662
|
-
|
|
663
|
-
## Open Questions
|
|
664
|
-
|
|
665
|
-
- Which model provider should be the first chat-generation adapter?
|
|
666
|
-
- Should the initial UI be a small custom app or a minimal server-rendered page?
|
|
667
|
-
- Should vector search use `sqlite-vec` immediately or begin with a simple
|
|
668
|
-
in-process vector scan for MVP scale?
|
|
669
|
-
- What exact `pdf-2-llm` output fields should be considered stable public API?
|
|
670
|
-
- Should MCP mode launch from the same index server or as a separate process?
|