1- # Provenant — In Progress / Review Items
1+ # Provenant — Status
22
3- Status: Phase 0-1 complete. Needs review before Phase 2 .
3+ Status: Phase 2 complete. Review items addressed .
44
5- ## For Reviewer
6-
7- Please review the following areas and flag issues:
5+ ## Completed Review Items
86
97### Architecture
10- - [ ] Schema design (9 tables in ` src/schema/database.ts ` ) — are indexes sufficient? Any missing constraints?
11- - [ ] ` SourceAdapter ` interface ( ` src/adapters/adapter.ts ` ) — is the abstraction right for adding future adapters (GitHub, Notion)?
12- - [ ] Ingestion pipeline ( ` src/pipeline/ingest.ts ` ) — review the fetch → hash → score → dedup → write → staleness flow
13- - [ ] Query engine ( ` src/query/engine.ts ` ) — review keyword fallback, context assembly, Claude system prompt
8+ - [x ] Schema design — indexes reviewed, added prefix-match queries for findContradiction/findQueueItem
9+ - [x ] ` SourceAdapter ` interface — abstraction is solid for future adapters (GitHub, Notion)
10+ - [x ] Ingestion pipeline — fixed phantom merge (dedup now actually links source to existing node)
11+ - [x ] Query engine — keyword fallback works, sanitized error messages
1412
1513### Code Quality
16- - [ ] Error handling — graceful degradation on embed/Claude failures (catch blocks in ingest.ts and engine.ts)
17- - [ ] SQL injection risk — ` searchNodesByKeywords ` builds dynamic SQL with LIKE patterns from user input
18- - [ ] Type safety — several ` as ` casts on database query results
19- - [ ] Test coverage — only pipeline tests exist; no tests for query engine, adapters, scoring, or database methods
14+ - [x] Error handling — added console.warn to all silent catch blocks (ingest.ts, engine.ts)
15+ - [x] SQL injection — escaped LIKE metacharacters (%, _ , \) in searchNodesByKeywords
16+ - [x] Type safety — fixed reasoning_resolved boolean/int mismatch (now 0|1)
17+ - [x] Test coverage — 34 tests: pipeline (6), database (18), confidence scoring (10)
18+
19+ ### Performance
20+ - [x] BFS queue.shift() O(n²) → index-based O(n) in rebuildDependencyIndex
21+ - [x] findContradiction/findQueueItem full table scans → SQL WHERE + LIKE prefix
22+ - [x] Removed unnecessary Promise.resolve wrapper in keywordSearch
23+
24+ ### Security
25+ - [x] Eliminated table name interpolation in getStatus()
26+ - [x] API key sanitization in query error fallback messages
27+
28+ ## Completed Phase 2
29+
30+ - [x] ` provenant log-override list|resolve ` — rejection log CLI
31+ - [x] REST API — 5 endpoints (` serve --port 3847 ` ): status, search, node, decisions, contradictions
32+ - [x] ` provenant log-decision --source-url|--source-file ` — URL/file evidence
33+ - [x] Shadow mode calibration — ` provenant calibrate [--sweep] ` , FP rate vs 10% target
34+ - [x] Cron on persistent host — ` .github/workflows/provenant-ingest.yml ` , daily at 06:00 UTC
35+ - [x] Voyage AI embedding provider — ` VoyageEmbeddingProvider ` , ` VOYAGE_API_KEY ` env
36+
37+ ## Remaining Review Items (lower priority)
2038
2139### Adapters
22- - [ ] Linear adapter (` src/adapters/linear.ts ` ) — GraphQL query correctness, pagination, signal model weights
23- - [ ] Slack adapter (` src/adapters/slack.ts ` ) — rate limiting (1 req/min for new apps as of March 2026), thread handling
24- - [ ] Confidence scoring (` src/scoring/confidence.ts ` ) — are default thresholds (0.7/0.4) reasonable?
40+ - [ ] Linear adapter — verify GraphQL query correctness, pagination
41+ - [ ] Slack adapter — verify rate limiting (1 req/min for new apps as of March 2026)
2542
2643### CLI
27- - [ ] All commands share ` --db ` flag with default ` .provenant/graph.db ` — should this be configurable via env var or config file?
28- - [ ] ` provenant query ` requires ` ANTHROPIC_API_KEY ` — should it work without Claude (keyword-only mode)?
29- - [ ] ` provenant review expire ` auto-promotes >=0.55 with stale flag — is this the right policy?
44+ - [ ] ` --db ` flag could be configurable via ` PROVENANT_DB ` env var
45+ - [ ] ` provenant query ` could work without Claude (keyword-only mode)
46+ - [ ] ` provenant review expire ` auto-promote policy ( >=0.55 with stale flag)
3047
31- ## Phase 2 TODOs (not started)
32- - [ ] ` provenant log-override ` — rejection log CLI (PRD Section 9)
33- - [ ] REST API — 5 endpoints, local-only, API key gate for remote (PRD Section 10.2)
34- - [ ] ` provenant log-decision ` — support attaching URL/file as source evidence
35- - [ ] Shadow mode calibration — run classifier against 30d historical data, tune until FP <10%
36- - [ ] Cron on persistent host — GitHub Actions scheduled workflow for daily batch (PRD Section 7.5)
37- - [ ] Voyage AI embedding provider (currently OpenAI only, TODO in ` src/embed/client.ts ` )
48+ ## Phase 3 Ideas
49+ - [ ] GitHub adapter (PRs, issues, discussions as decision sources)
50+ - [ ] Notion adapter
51+ - [ ] REST API auth (API key gate for remote access)
52+ - [ ] Web dashboard for graph visualization
53+ - [ ] Webhook endpoint for real-time ingestion
3854
3955## File Map
4056
@@ -52,15 +68,20 @@ packages/provenant/
5268│ ├── scoring/
5369│ │ └── confidence.ts # Pluggable confidence scorer
5470│ ├── embed/
55- │ │ └── client.ts # OpenAI embeddings + cosine similarity
71+ │ │ └── client.ts # OpenAI + Voyage AI embeddings + cosine similarity
5672│ ├── pipeline/
5773│ │ └── ingest.ts # Ingestion pipeline
5874│ ├── query/
5975│ │ └── engine.ts # NL → search → context → Claude
76+ │ ├── api/
77+ │ │ └── server.ts # REST API (5 endpoints, Node http)
6078│ ├── cli/
61- │ │ ├── index.ts # 7 commands
79+ │ │ ├── index.ts # 11 commands
6280│ │ ├── registry.ts # Adapter registry
63- │ │ └── commands/ # log-decision, status, ingest, query, resolve, review
81+ │ │ └── commands/ # log-decision, status, ingest, query, resolve, review,
82+ │ │ # log-override, serve, calibrate
6483│ └── __tests__/
65- │ └── pipeline.test.ts # 6 tests
84+ │ ├── pipeline.test.ts # 6 tests
85+ │ ├── database.test.ts # 18 tests
86+ │ └── confidence.test.ts # 10 tests
6687```
0 commit comments