Add model card with full documentation
Browse files
README.md
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
tags:
|
| 4 |
+
- code-assistant
|
| 5 |
+
- kintsugi
|
| 6 |
+
- bdi
|
| 7 |
+
- pharos
|
| 8 |
+
- ollama
|
| 9 |
+
- agent
|
| 10 |
+
- security
|
| 11 |
+
---
|
| 12 |
+
|
| 13 |
+
# Project Rivet
|
| 14 |
+
|
| 15 |
+
A Kintsugi-based coding agent for the Multiverse Campus codebase. Built on BDI (Belief-Desire-Intention) cognition with a discipline gate that refuses destructive operations against a shared staging/production database.
|
| 16 |
+
|
| 17 |
+
This is a production code assistant for a real deployed application β 120 tables, 377 migrations, 49 Zustand stores, 75 route files β not a toy example.
|
| 18 |
+
|
| 19 |
+
## Features
|
| 20 |
+
|
| 21 |
+
- **BDI cognition engine** β Beliefs carry confidence scores and evidence chains. Plans are recorded as BDI intentions with the beliefs they rest on
|
| 22 |
+
- **DAG-enforced skill prerequisites** β Skills execute in dependency order: evidence gathering (L0) before synthesis (L1) before testing (L2) before discipline gate (L3). No path around the gate
|
| 23 |
+
- **Pharos knowledge injection** β Structured knowledge packs (security patterns, TypeScript patterns, campus architecture) injected at inference time via KV cache or system prompt
|
| 24 |
+
- **Discipline gate** β Refuses destructive migrations (DROP, RENAME, TRUNCATE, DELETE FROM). Earned confidence levels (HIGH/MED/LOW) based on evidence quality. No destructive SQL printed even as negative examples
|
| 25 |
+
- **Full security audit context** β 13-finding security audit loaded as beliefs with confidence scores. Agent reasons from known vulnerabilities, not guesses
|
| 26 |
+
- **Tool harness** β File tools (read, write, search), git tools (diff, log, blame), test tools (tsc, npm test), schema tools (table inspection, migration history)
|
| 27 |
+
|
| 28 |
+
## Architecture
|
| 29 |
+
|
| 30 |
+
```
|
| 31 |
+
POST /ask {question, user}
|
| 32 |
+
|
|
| 33 |
+
SessionManager per-user isolation, rate limits
|
| 34 |
+
|
|
| 35 |
+
Planner intent -> BDI intention -> SkillDAG
|
| 36 |
+
|
|
| 37 |
+
Kintsugi DAGExecutor layer-parallel execution
|
| 38 |
+
|
|
| 39 |
+
L0: code_analysis, migration_safety, security_review (evidence)
|
| 40 |
+
L1: synthesis (single model call with beliefs + Pharos packs)
|
| 41 |
+
L2: test_runner (tsc/npm verification)
|
| 42 |
+
L3: discipline_gate (belief checks -> BLOCK/WARN, no path around)
|
| 43 |
+
|
|
| 44 |
+
response
|
| 45 |
+
```
|
| 46 |
+
|
| 47 |
+
## Stack
|
| 48 |
+
|
| 49 |
+
| Component | Implementation |
|
| 50 |
+
|-----------|---------------|
|
| 51 |
+
| LLM | Qwen2.5-Coder:32B via Ollama |
|
| 52 |
+
| Cognition | Kintsugi BDI engine (vendored) |
|
| 53 |
+
| Knowledge | Pharos pack server (security, TypeScript, architecture packs) |
|
| 54 |
+
| Skills | DAG-ordered: code analysis, migration safety, security review, synthesis, test runner, discipline gate |
|
| 55 |
+
| Target codebase | Node.js 20, TypeScript, Express 4, React 18, PostgreSQL 16, Redis 7 |
|
| 56 |
+
|
| 57 |
+
## Key Design Decisions
|
| 58 |
+
|
| 59 |
+
**Shared database constraint.** Staging and production share the same PostgreSQL instance. Every migration must be additive-only, backward compatible, and reversible. The discipline gate enforces this β it is not advisory.
|
| 60 |
+
|
| 61 |
+
**Suggest, don't decree.** The agent is a colleague, not the lead. It suggests, explains, and flags risk. It defers to the humans who run the system.
|
| 62 |
+
|
| 63 |
+
**Evidence-based confidence.** Every recommendation carries a confidence level derived from what the agent actually read (source files, schema, audit findings), not from training data assumptions.
|
| 64 |
+
|
| 65 |
+
## Requirements
|
| 66 |
+
|
| 67 |
+
- Ollama with `qwen2.5-coder:32b` pulled
|
| 68 |
+
- Pharos pack server (optional, for knowledge injection)
|
| 69 |
+
- Python 3.10+
|
| 70 |
+
|
| 71 |
+
## Usage
|
| 72 |
+
|
| 73 |
+
```bash
|
| 74 |
+
cd v2
|
| 75 |
+
pip install -r requirements.txt
|
| 76 |
+
./setup.sh
|
| 77 |
+
python rivet.py
|
| 78 |
+
```
|
| 79 |
+
|
| 80 |
+
## Repository Structure
|
| 81 |
+
|
| 82 |
+
```
|
| 83 |
+
v2/
|
| 84 |
+
rivet.py # Entry point
|
| 85 |
+
kintsugi_core.py # Kintsugi engine integration
|
| 86 |
+
kintsugi_config.yaml # Operator constraints and beliefs
|
| 87 |
+
engine/
|
| 88 |
+
planner.py # BDI intention planning
|
| 89 |
+
beliefs.py # Confidence-scored belief store
|
| 90 |
+
session.py # Per-user session management
|
| 91 |
+
synthesis.py # LLM synthesis (single model call)
|
| 92 |
+
memory.py # Conversation memory
|
| 93 |
+
model_client.py # Ollama API client
|
| 94 |
+
skills/
|
| 95 |
+
code_analysis.py # Source code reading and analysis
|
| 96 |
+
migration_safety.py # Schema + SQL safety checks
|
| 97 |
+
security_review.py # Audit-informed security review
|
| 98 |
+
discipline_gate.py # Final BLOCK/WARN gate
|
| 99 |
+
test_runner.py # tsc/npm test verification
|
| 100 |
+
tools/
|
| 101 |
+
file_tools.py # File read/write/search
|
| 102 |
+
git_tools.py # Git diff/log/blame
|
| 103 |
+
schema_tools.py # Table inspection, migration history
|
| 104 |
+
test_tools.py # Test execution
|
| 105 |
+
guard.py # Input validation
|
| 106 |
+
pharos/
|
| 107 |
+
pack_loader.py # Pharos pack loading
|
| 108 |
+
kv_injector.py # KV cache injection
|
| 109 |
+
context/
|
| 110 |
+
architecture_map.md # Full system architecture
|
| 111 |
+
audit_findings.md # 13-finding security audit
|
| 112 |
+
audit_report.md # Detailed audit report
|
| 113 |
+
```
|
| 114 |
+
|
| 115 |
+
## Authors
|
| 116 |
+
|
| 117 |
+
CC (Coalition Code) and Nexus, Liberation Labs / Transparent Humboldt Coalition
|
| 118 |
+
|
| 119 |
+
## License
|
| 120 |
+
|
| 121 |
+
Apache 2.0
|