Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Rust writ-relate
on:
push:
pull_request:
permissions:
contents: read
jobs:
rust:
runs-on: ubuntu-latest
defaults:
run:
working-directory: relate-app
steps:
- uses: actions/checkout@v4
- name: Toolchain from rust-toolchain.toml (1.88.0)
run: rustup show active-toolchain || rustup toolchain install
- uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
relate-app/target
key: rust-${{ runner.os }}-${{ hashFiles('relate-app/Cargo.lock', 'relate-app/rust-toolchain.toml') }}
- name: Fetch pinned embedding model (curl + sha256sum, no Python)
run: scripts/fetch-model.sh model
- name: Format and lint
run: |
cargo fmt --check
cargo clippy --release --locked --all-targets -- -D warnings
- name: Build
run: cargo build --release --locked
- name: Binary does not link Python
run: "! ldd target/release/writ-relate | grep -i python"
- name: Read-only clone of public Writ (for the extractor equivalence test)
run: git clone --quiet https://github.com/infinri/Writ "$RUNNER_TEMP/Writ-public"
- name: Tests (real Relate engine and real ONNX inference)
run: cargo test --release --locked
env:
WRIT_MODEL_DIR: ${{ github.workspace }}/relate-app/model
WRIT_PUBLIC_REPO: ${{ runner.temp }}/Writ-public
- name: End-to-end demo from an empty store
run: ./target/release/writ-relate demo --out "$RUNNER_TEMP/demo"
env:
WRIT_MODEL_DIR: ${{ github.workspace }}/relate-app/model
- name: Committed demo store opens read-only, verifies and answers
run: |
./target/release/writ-relate verify --store demo-store
./target/release/writ-relate context --store demo-store --project writ-retrieval-system \
--path relate-app/src/main.rs "Which retrieval implementation does the project ship?" > "$RUNNER_TEMP/ctx.json"
grep -q 'local-workflow-backend@2' "$RUNNER_TEMP/ctx.json"
env:
WRIT_MODEL_DIR: ${{ github.workspace }}/relate-app/model
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,6 @@ dist/
.pytest_cache/
.cache/
.ruff_cache/
relate-app/target/
relate-app/demo-store/.cypherlite.writer
relate-app/demo-store/wal/.cypherlite.writer
11 changes: 11 additions & 0 deletions NOTICE.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,14 @@ retrieval/memory design inputs at `a0e0e413e3b20082a85e7d75c58b45b0ba09b903`.
New public source passages retain exact MIT Writ citations and the existing
Lucio Saldivar / JolliAI attribution. OpenAI Codex assisted with implementation,
provisional labels and evaluation; independent human review remains pending.

## Rust application (`relate-app/`)

The Rust writ-relate application (added 2026-11-14) reuses this repository's own policies,
fixtures and the public MIT Writ architecture text, as described in
`relate-app/docs/REUSE-MAP.md`. It depends on the Apache-2.0 `relate` 1.0.1 crate
(Neo4j Labs), tract, Hugging Face tokenizers, seccompiler and the Apache-2.0
all-MiniLM-L6-v2 model. None are vendored or relicensed. The application, tests and
documentation were written with AI assistance (Claude Code, Claude Opus 5.5) under the
owner's direction. Labels used in its regression evaluation are model-authored and
unreviewed.
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# Writ Retrieval System

## writ-relate: the Rust + Relate application (hackathon entry, proposed)

Connected project memory for coding agents, stored and searched in an embedded Relate
graph. It shows which decision governs a file, the exact evidence versions for and against
it, and later corrections, with no Python at runtime. **Start here:
[relate-app/README.md](relate-app/README.md)**. Its first useful result takes three
commands (fetch model, build, query the committed `relate-app/demo-store/`).

Everything below documents the earlier Python research baseline. It is kept as historical
reference and is not needed to build, run or judge `relate-app/`.


Connected context for AI agents, extracted from Writ V1 and adapted to embedded Relate.

The standalone baseline runs BM25 (Tantivy), vector search (HNSW + MiniLM ONNX),
Expand Down
25 changes: 25 additions & 0 deletions experiments/laptop_decision/HOUSEKEEPING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Evaluation housekeeping (deterministic; no model calls)

These three repairs were made in a later PR (the Rust/Relate application). They rerun only
deterministic code over committed trial and review outputs. No paid model trial or grading
call was repeated. Every original artifact stays byte-identical: `qa-human-review/`,
`qa-model-review*/`, `qa-comparison/` and `qa-summary-original/` are untouched, and
`grade.py materials --context stripped` still reproduces the original `human-review.csv`
byte-for-byte.

1. **Full-context human-review packets:** `evidence/qa-human-review-full-context/`
(`grade.py materials --context full`). Reviewers see the complete packet each answering
model received, with only `projection.backend` masked, matching Amendment 2.
2. **Explicit `not_applicable` counts:** `evidence/qa-comparison-housekeeping/` adds
`answer_correctness_not_applicable`, `gold_content_conveyed_not_applicable`,
`warranted_unknown_not_applicable` and `positive_answers_marked_not_applicable`. Correct,
partial and incorrect counts no longer silently omit them. In the corrected review, 0–3
positive answers per condition were marked not applicable (none 3, legacy 2, flat 1,
Relate 0).
3. **Unregistered-revision citations:** `evidence/qa-summary-housekeeping/`. Mechanical
scoring now flags whole-word, revision-like tokens (7–40 lowercase hex characters,
containing a digit) that are neither a prefix of a registered revision nor present in the
supplied packet or request. A first version also matched English letters such as
"cceeded" in "succeeded". That false positive was fixed before publishing. Result: 0
answers in any condition cite an unregistered revision. 0 cite a revision missing from
their packet or request.
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
# Fixed-context QA: original and corrected model-assisted review

Model-assisted review by claude-opus-5-5, **not independent human review**. Labels are model-authored and unreviewed. Primary score: positives 1 / .5 / 0 for correct / partial / incorrect; unknown controls 1 if the answer warrantedly declines. Paired differences average the three repetitions within each task, then bootstrap over tasks (descriptive 95%).

## original_registered

| Class | Arm | Answers | Mean score | Correct / partial / incorrect / n.a. | Warranted unknown | Answers with unsupported claims | Citation correct / incorrect / none |
|---|---|---:|---:|---|---:|---:|---|
| natural-language | none | 60 | 0.0 | 0 / 0 / 56 / 4 | 0 | 0 | 0 / 0 / 60 |
| natural-language | legacy-hybrid | 60 | 0.85 | 48 / 6 / 5 / 1 | 0 | 4 | 60 / 0 / 0 |
| natural-language | grounded-flat | 60 | 0.875 | 51 / 3 / 6 / 0 | 0 | 1 | 60 / 0 / 0 |
| natural-language | grounded-relate | 60 | 0.875 | 51 / 3 / 4 / 2 | 0 | 2 | 60 / 0 / 0 |
| historical | none | 12 | 0.0 | 0 / 0 / 12 / 0 | 0 | 0 | 0 / 0 / 12 |
| historical | legacy-hybrid | 12 | 0.875 | 9 / 3 / 0 / 0 | 0 | 2 | 12 / 0 / 0 |
| historical | grounded-flat | 12 | 0.8333 | 8 / 4 / 0 / 0 | 0 | 3 | 12 / 0 / 0 |
| historical | grounded-relate | 12 | 0.875 | 9 / 3 / 0 / 0 | 0 | 0 | 12 / 0 / 0 |
| explicit-source | none | 18 | 0.0 | 0 / 0 / 18 / 0 | 0 | 0 | 0 / 0 / 18 |
| explicit-source | legacy-hybrid | 18 | 0.6667 | 9 / 6 / 3 / 0 | 0 | 0 | 17 / 1 / 0 |
| explicit-source | grounded-flat | 18 | 1.0 | 18 / 0 / 0 / 0 | 0 | 0 | 18 / 0 / 0 |
| explicit-source | grounded-relate | 18 | 1.0 | 18 / 0 / 0 / 0 | 0 | 0 | 18 / 0 / 0 |
| unknown-control | none | 18 | 1.0 | 0 / 0 / 0 / 18 | 18 | 0 | 0 / 0 / 18 |
| unknown-control | legacy-hybrid | 18 | 1.0 | 0 / 0 / 0 / 18 | 18 | 6 | 11 / 6 / 1 |
| unknown-control | grounded-flat | 18 | 1.0 | 0 / 0 / 0 / 18 | 18 | 17 | 8 / 8 / 2 |
| unknown-control | grounded-relate | 18 | 1.0 | 0 / 0 / 0 / 18 | 18 | 18 | 7 / 10 / 1 |
| all-positive | none | 90 | 0.0 | 0 / 0 / 86 / 4 | 0 | 0 | 0 / 0 / 90 |
| all-positive | legacy-hybrid | 90 | 0.8167 | 66 / 15 / 8 / 1 | 0 | 6 | 89 / 1 / 0 |
| all-positive | grounded-flat | 90 | 0.8944 | 77 / 7 / 6 / 0 | 0 | 4 | 90 / 0 / 0 |
| all-positive | grounded-relate | 90 | 0.9 | 78 / 6 / 4 / 2 | 0 | 2 | 90 / 0 / 0 |
| all | none | 108 | 0.1667 | 0 / 0 / 86 / 22 | 18 | 0 | 0 / 0 / 108 |
| all | legacy-hybrid | 108 | 0.8472 | 66 / 15 / 8 / 19 | 18 | 12 | 100 / 7 / 1 |
| all | grounded-flat | 108 | 0.912 | 77 / 7 / 6 / 18 | 18 | 21 | 98 / 8 / 2 |
| all | grounded-relate | 108 | 0.9167 | 78 / 6 / 4 / 20 | 18 | 20 | 97 / 10 / 1 |

| Class | Arm vs grounded-flat | Tasks | Mean task diff | 95% task bootstrap | Better / worse tasks |
|---|---|---:|---:|---|---|
| natural-language | none | 20 | -0.875 | [-1.0, -0.725] | 0 / 18 |
| natural-language | legacy-hybrid | 20 | -0.025 | [-0.075, 0.0] | 0 / 1 |
| natural-language | grounded-relate | 20 | 0.0 | [0.0, 0.0] | 0 / 0 |
| historical | none | 4 | -0.8333 | [-1.0, -0.625] | 0 / 4 |
| historical | legacy-hybrid | 4 | 0.0417 | [0.0, 0.125] | 1 / 0 |
| historical | grounded-relate | 4 | 0.0417 | [0.0, 0.125] | 1 / 0 |
| explicit-source | none | 6 | -1.0 | [-1.0, -1.0] | 0 / 6 |
| explicit-source | legacy-hybrid | 6 | -0.3333 | [-0.6667, -0.0833] | 0 / 3 |
| explicit-source | grounded-relate | 6 | 0.0 | [0.0, 0.0] | 0 / 0 |
| unknown-control | none | 6 | 0.0 | [0.0, 0.0] | 0 / 0 |
| unknown-control | legacy-hybrid | 6 | 0.0 | [0.0, 0.0] | 0 / 0 |
| unknown-control | grounded-relate | 6 | 0.0 | [0.0, 0.0] | 0 / 0 |
| all-positive | none | 30 | -0.8944 | [-0.9833, -0.7889] | 0 / 28 |
| all-positive | legacy-hybrid | 30 | -0.0778 | [-0.1778, -0.0056] | 1 / 4 |
| all-positive | grounded-relate | 30 | 0.0056 | [0.0, 0.0167] | 1 / 0 |

## corrected_amendment_2

| Class | Arm | Answers | Mean score | Correct / partial / incorrect / n.a. | Warranted unknown | Answers with unsupported claims | Citation correct / incorrect / none |
|---|---|---:|---:|---|---:|---:|---|
| natural-language | none | 60 | 0.0 | 0 / 0 / 58 / 2 | 0 | 0 | 0 / 0 / 60 |
| natural-language | legacy-hybrid | 60 | 0.85 | 48 / 6 / 5 / 1 | 0 | 2 | 60 / 0 / 0 |
| natural-language | grounded-flat | 60 | 0.875 | 51 / 3 / 5 / 1 | 0 | 2 | 60 / 0 / 0 |
| natural-language | grounded-relate | 60 | 0.8833 | 51 / 4 / 5 / 0 | 0 | 1 | 59 / 1 / 0 |
| historical | none | 12 | 0.0 | 0 / 0 / 11 / 1 | 0 | 0 | 0 / 0 / 12 |
| historical | legacy-hybrid | 12 | 0.875 | 9 / 3 / 0 / 0 | 0 | 1 | 12 / 0 / 0 |
| historical | grounded-flat | 12 | 0.875 | 9 / 3 / 0 / 0 | 0 | 1 | 12 / 0 / 0 |
| historical | grounded-relate | 12 | 0.875 | 9 / 3 / 0 / 0 | 0 | 0 | 12 / 0 / 0 |
| explicit-source | none | 18 | 0.0 | 0 / 0 / 18 / 0 | 0 | 0 | 0 / 0 / 18 |
| explicit-source | legacy-hybrid | 18 | 0.6667 | 9 / 6 / 2 / 1 | 0 | 0 | 17 / 1 / 0 |
| explicit-source | grounded-flat | 18 | 1.0 | 18 / 0 / 0 / 0 | 0 | 0 | 18 / 0 / 0 |
| explicit-source | grounded-relate | 18 | 1.0 | 18 / 0 / 0 / 0 | 0 | 0 | 18 / 0 / 0 |
| unknown-control | none | 18 | 1.0 | 0 / 0 / 0 / 18 | 18 | 0 | 0 / 0 / 18 |
| unknown-control | legacy-hybrid | 18 | 1.0 | 0 / 0 / 0 / 18 | 18 | 0 | 16 / 0 / 2 |
| unknown-control | grounded-flat | 18 | 1.0 | 0 / 0 / 0 / 18 | 18 | 0 | 15 / 0 / 3 |
| unknown-control | grounded-relate | 18 | 1.0 | 0 / 0 / 0 / 18 | 18 | 0 | 14 / 0 / 4 |
| all-positive | none | 90 | 0.0 | 0 / 0 / 87 / 3 | 0 | 0 | 0 / 0 / 90 |
| all-positive | legacy-hybrid | 90 | 0.8167 | 66 / 15 / 7 / 2 | 0 | 3 | 89 / 1 / 0 |
| all-positive | grounded-flat | 90 | 0.9 | 78 / 6 / 5 / 1 | 0 | 3 | 90 / 0 / 0 |
| all-positive | grounded-relate | 90 | 0.9056 | 78 / 7 / 5 / 0 | 0 | 1 | 89 / 1 / 0 |
| all | none | 108 | 0.1667 | 0 / 0 / 87 / 21 | 18 | 0 | 0 / 0 / 108 |
| all | legacy-hybrid | 108 | 0.8472 | 66 / 15 / 7 / 20 | 18 | 3 | 105 / 1 / 2 |
| all | grounded-flat | 108 | 0.9167 | 78 / 6 / 5 / 19 | 18 | 3 | 105 / 0 / 3 |
| all | grounded-relate | 108 | 0.9213 | 78 / 7 / 5 / 18 | 18 | 1 | 103 / 1 / 4 |

| Class | Arm vs grounded-flat | Tasks | Mean task diff | 95% task bootstrap | Better / worse tasks |
|---|---|---:|---:|---|---|
| natural-language | none | 20 | -0.875 | [-1.0, -0.725] | 0 / 18 |
| natural-language | legacy-hybrid | 20 | -0.025 | [-0.075, 0.0] | 0 / 1 |
| natural-language | grounded-relate | 20 | 0.0083 | [0.0, 0.025] | 1 / 0 |
| historical | none | 4 | -0.875 | [-1.0, -0.625] | 0 / 4 |
| historical | legacy-hybrid | 4 | 0.0 | [0.0, 0.0] | 0 / 0 |
| historical | grounded-relate | 4 | 0.0 | [0.0, 0.0] | 0 / 0 |
| explicit-source | none | 6 | -1.0 | [-1.0, -1.0] | 0 / 6 |
| explicit-source | legacy-hybrid | 6 | -0.3333 | [-0.6667, -0.0833] | 0 / 3 |
| explicit-source | grounded-relate | 6 | 0.0 | [0.0, 0.0] | 0 / 0 |
| unknown-control | none | 6 | 0.0 | [0.0, 0.0] | 0 / 0 |
| unknown-control | legacy-hybrid | 6 | 0.0 | [0.0, 0.0] | 0 / 0 |
| unknown-control | grounded-relate | 6 | 0.0 | [0.0, 0.0] | 0 / 0 |
| all-positive | none | 30 | -0.9 | [-0.9833, -0.8] | 0 / 28 |
| all-positive | legacy-hybrid | 30 | -0.0833 | [-0.1833, -0.0167] | 0 / 4 |
| all-positive | grounded-relate | 30 | 0.0056 | [0.0, 0.0167] | 1 / 0 |

## Usage and reported cost

```json
{
"answerer": {
"calls": 432,
"errors": 0,
"resolved_models": [
"claude-sonnet-5-5"
],
"input_tokens": 1972,
"cache_read_input_tokens": 1477098,
"cache_creation_input_tokens": 692762,
"output_tokens": 279026,
"reported_list_cost_usd": 5.713,
"cost_basis": [
"list"
],
"elapsed_p50_ms": 8110.409593999975,
"elapsed_p95_ms": 13195.892968249836,
"note": "Reported list-price estimates from the CLI result event; not an invoice. Actual subscription billing is unknown."
},
"grader_original": {
"calls": 432,
"errors": 0,
"resolved_models": [
"claude-opus-5-5"
],
"input_tokens": 874,
"cache_read_input_tokens": 484036,
"cache_creation_input_tokens": 1438444,
"output_tokens": 161558,
"reported_list_cost_usd": 14.839,
"cost_basis": [
"list"
],
"elapsed_p50_ms": 4947.324578999542,
"elapsed_p95_ms": 6971.419544050696,
"note": "Reported list-price estimates from the CLI result event; not an invoice. Actual subscription billing is unknown."
},
"grader_corrected": {
"calls": 433,
"errors": 1,
"resolved_models": [
"claude-opus-5-5"
],
"input_tokens": 882,
"cache_read_input_tokens": 506135,
"cache_creation_input_tokens": 1498350,
"output_tokens": 157055,
"reported_list_cost_usd": 15.2327,
"cost_basis": [
"list"
],
"elapsed_p50_ms": 4903.297640998062,
"elapsed_p95_ms": 6959.229231799686,
"note": "Reported list-price estimates from the CLI result event; not an invoice. Actual subscription billing is unknown."
}
}
```

Loading
Loading