Skip to content
Open
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
2 changes: 1 addition & 1 deletion relate-app/docs/ADR-0002-rust-relate.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# ADR-0002: Ship a Rust-native, Relate-centered connected-memory application

**Status: PROPOSED (implemented on branch `rust-relate-app`; not owner-approved, not merged).**
**Status: implemented and merged in PR #11 (`00505e9`).** The merge records that the owner accepted the code change. It does not confirm any stored assertion, label or evidence record; those remain unverified unless a later owner-confirmation step says otherwise.

## Context

Expand Down
61 changes: 61 additions & 0 deletions relate-app/docs/CONTRACTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Contracts

## Time semantics (implemented in increment A)

- **Valid time:** `recorded_at` is the owner-declared time a record or association took
effect. `valid_to` closes its applicability (half-open interval). `superseded_at` is set by
a supersession, and `retracted_at` by a retraction.
- **Transaction time:** `ingested_at` is the wall-clock time the store accepted a write.
It is stored for audit and is not used for filtering.
- **Ordering rules enforced on write:**
- A supersession is not earlier than the revision it replaces.
- An evidence association is not earlier than its decision or its evidence record.
- A conflict is not earlier than either decision.
- A retraction is not earlier than its association.
- A decision is not earlier than the guidance it cites.
- **Request time:** `context` without `--as-of` is a current request (now), served from the
current-only native partitions. `--as-of T` is a point-in-time request: every version in
scope is searched, and a record is in effect if
`recorded_at <= T < valid_to` and it was not superseded at or before T. Associations count
only if created at or before T. Retractions count only if made at or before T. Items carry
`lifecycle` (at T) and `stored_lifecycle` (now).
- Point-in-time search needs the all-version index (`fth_<scope>`), which this version
creates. Stores created by PR #11 (including the committed baseline `demo-store/`) report
point-in-time search as **unsupported** instead of returning a wrong answer.
- This is a reconstruction of recorded valid time. It is not a snapshot of what the store
physically contained at T, so backdated captures appear in point-in-time views.

## Conflict bundles

Recorded `CONFLICTS_WITH` links form components. Components are traversed up to 4 hops
and 12 members, and every node must be visible and in effect. Each payload lists
`conflict_bundles` with `complete` and, if incomplete, the reason. A required record whose
component cannot be established completely is an error. Membership means pairwise recorded
conflicts; it does not assert that every pair contradicts.

## Existing record contracts (PR #11)

`writ-passage-fixture/1`, `writ-relate-capture/1` (decision, evidence, supersede, conflict),
`writ-relate-retract/1`, `writ-relate-context/1`, `writ-relate-inspect/1`,
`writ-relate-verify/1`. See `src/memory.rs` and `demo/seed/` for exact shapes.

## General knowledge contracts (specified in A; implementation in B)

One record family, `writ-relate-record/1`, with an explicit `kind`. Identity is
`scope|Kind|id@revision`. All kinds carry: `source` (URI, exact revision, path and lines, or
an explicit `null` meaning a local owner record), `content_digest`, `recorded_at`, optional
`valid_to`, `rationale` (text or `null` meaning unknown) and `judgment` (see below). Import
and capture never set verification or approval.

| Kind | Purpose | Distinguishes |
|---|---|---|
| `source` | A document or artifact at an exact revision | identity only, not truth |
| `claim` | A descriptive assertion found in a source | `judgment: descriptive` |
| `guidance` | Normative guidance (existing `Guidance`) | `judgment: normative`; imported guidance is not approved |
| `decision` | A historical choice (existing) | `judgment: decision` |
| `observation` | Something recorded as happening: tool result, log line, outcome, attempt | `observation_kind: tool_output, log, outcome_success, outcome_failure, outcome_unknown, attempt, exception` |
| `lesson` | A proposed generalization from cases | `judgment: proposed_explanation`; a model may propose it but cannot certify it |
| `question` | An open question that could change an answer | |
| `investigation` | A ledger entry: question, assumptions, actions, observations, counterexamples, conclusion, stop reason | |
| `goal` | An explicit goal with constraints | |
| `recommendation` | A proposed next action tied to goals, prerequisites, alternatives and change conditions | never execution permission |
45 changes: 45 additions & 0 deletions relate-app/docs/RESULTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,11 @@ scope failures, and a maximum payload of 5,996 of 6,000 characters.
| Python grounded_cli `--backend relate` | 916–917 | 1004–1030 | 235 | 2.29 |
| Python grounded_cli (flat) | 808–809 | 926–929 | 281 | 2.23 |

**Budget mismatch (disclosed after review):** the committed benchmark commands use each CLI's
default budget. Rust `context` defaults to 16,000 bytes / 12,000 codepoints; Python
`grounded_cli` defaults to 8,000 / 6,000. These are default-workflow observations, not a
matched-budget comparison. No new language comparison is planned.

These are whole-CLI differences: language, runtime imports, inference engine (tract vs
onnxruntime) and implementation all differ, so no language-only speedup is claimed.
Native Relate retrieval keeps the lower cold-process memory seen in the earlier Python
Expand Down Expand Up @@ -125,3 +130,43 @@ about task success.
extracted.
- Labels are unreviewed. No independent human review and no generative-agent outcome
experiment was run for this application.

## Increment A: reliability repairs (after PR #11 review)

Six defects found by an independent review were reproduced on the real engine
(`evidence/review-repros-pr11/`: probe source, baseline output where all six probes passed,
and post-fix output where all six fail). They were then replaced by desired-contract tests
(`tests/temporal_contracts.rs`, 6 tests):

1. Evidence recorded after `as_of` was delivered as active support. Associations and evidence
now count only from their recorded time, and retractions only from theirs.
2. An expired conflict partner was rendered current. Partners that are not in effect are now
history, with `valid_to`.
3. An A–B–C conflict chain seeded at A omitted C. Components are now traversed up to 4 hops
and 12 members, flagged `complete` or not, and a required incomplete component is an
error.
4. `as_of` lost the then-current decision after a later supersession. Point-in-time
requests now search all versions through an all-version index. Older stores report
unsupported.
5. `check_utc` accepted February 31. Month lengths and leap years are now validated.
6. Backdated supersession was accepted. Interval ordering is now enforced for supersede,
associations, conflicts, retractions and cited guidance.

Review host note: one reviewer host rejected AF_UNIX sockets before the application's
seccomp filter ran, so `read_only_surfaces_deny_network` failed its Unix-socket assertion
there. The filter itself is unchanged and denies only AF_INET and AF_INET6. The test passes
on this laptop and in CI.

Regression check (`evidence/reliability-pr12/eval/`):

- Candidate order is identical across fusion owners on 72/72 tasks.
- Delivery changed only through payload size. Items now carry `stored_lifecycle`,
`valid_to` and `superseded_at`, and the header carries `time_semantics` and
`conflict_bundles`. Mean records per 8,000-byte payload fell from 2.68 to 2.50.
- Held-out natural delivery rose 21 → 22/24 (`hel-03` now fits). No task was lost against
PR #11.
- On `dev-25`, the Rust-fusion header label is 8 characters longer, so its third record no
longer fits (5,993 of 6,000 characters for the Cypher payload). Delivered passages
therefore differ on 1 of 72 tasks.

These are rendering effects on opened tasks, not retrieval gains.
43 changes: 43 additions & 0 deletions relate-app/docs/STATUS-MAP.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Capability status map

Baseline: PR #11 merged as `00505e9`. Updated with each increment.

The "Product Scope and Agreement Register" and the "Self-Improvement Research note" referenced
by the 2026-11-14 handoff are **not in this repository and were not supplied in the session**.
This map is built from the capability list in that handoff (the current-to-target map and the
assignment text). When the register is added, reconcile it here. Nothing below silently drops
an agreed capability.

Legend: **existing** = at PR #11 · **partial** = usable subset · **now** = implemented in
the increment named · **deferred** = recorded gap with reason.

| Area | Capability | Status | Where / gap |
|---|---|---|---|
| Retrieval | Rust + native Relate search, per-scope full-text, scoped vector, Cypher RRF | existing | `context::search` |
| Retrieval | Temporal (valid-time) semantics across all channels; point-in-time `--as-of` | **now (A)** | `context::live`, all-version index `fth_<scope>`; older stores report unsupported |
| Retrieval | Bounded, complete-or-flagged conflict components; required incomplete bundle is an error | **now (A)** | `MAX_CONFLICT_HOPS`=4, `MAX_CONFLICT_MEMBERS`=12 |
| Integrity | Calendar validation; interval ordering of supersede/association/conflict/retraction | **now (A)** | `util::check_utc`, `memory::capture`/`retract` |
| Integrity | Transaction time (`ingested_at`) recorded beside valid time (`recorded_at`) | **now (A)** | stored, not used for filtering (documented) |
| Records | Decisions, evidence, supersede, conflict, retraction, guidance import, Git extraction | existing | `memory.rs`, `extract.rs` |
| Records | General contracts: source, claim, observation, memory/lesson, question, investigation, goal, recommendation | specified (A) → B | `docs/CONTRACTS.md` |
| Records | Ingestion of local Markdown/plain text/structured records, outcomes, tool results, logs | partial | Markdown at exact Git revisions exists; local files and outcomes planned for B |
| Records | Deletion/tombstone semantics | deferred → B | retraction/supersession exist; tombstone planned |
| Relationships | GOVERNED_BY, AFFECTS, SUPPORTS, CONTRADICTS, SUPERSEDES, CONFLICTS_WITH | existing | |
| Relationships | Writ V1 registry audit (DEPENDS_ON … REALIZES) with endpoint semantics or deferral reasons | → B | |
| Feedback | Durable feedback, named confidence policy, active-contribution recomputation | → B | Python path exists (`reliable/store.py`); absent in Rust |
| Review | Local-owner confirmation/proposal review outside agent tools | → B | |
| Patterns | Experience-backed recurring patterns with cases, counterexamples and support policy | → C | |
| Investigation | Bounded epistemic controller and ledger (question → assumptions → action → observation → counterexample → conclusion/next) | → C | |
| Planning | Goal/constraint-based recommendations with alternatives and conditions | → C | |
| Model boundary | Thin adapter for hypothesis/question proposals via existing Claude Code; replay contract | → C | live trials marked NOT RUN when unavailable |
| Receipts | Versioned run/context receipts (scope, generation, candidates, scores, paths, omissions, payload, timings) | partial | context returns candidates/timings; persisted receipts → D |
| Diagnosis | Cause localization (missing knowledge, retrieval miss, ordering, stale, budget loss, …) | → D | |
| Improvement | Allowlisted config proposals tested by bounded replay; rejected proposals kept | → D | |
| Recovery | Derived-index verify/rebuild with atomic publication; retraction invalidates dependents | partial | `verify`, fail-closed open exist; rebuild/invalidation → D |
| Interface | Read-only MCP (context, inspect) | existing | |
| Interface | Read-only investigation/impact/pattern/plan views | → C/D | |
| Contest | Required topic `relate`; video | owner action | `docs/CONTEST.md` |

Not in scope by instruction: Python in the shipping path, a language bake-off, a broker or
kernel, M4 authentication, multi-writer or distributed services, enterprise tenancy,
neural training, autonomous source-code repair.
Loading
Loading