SPEC-005: elephant vocabulary layer (vocab/define, near-miss advisory, provenance) #2

Merged
anuna-02 merged 0 commits from refs/pull/2/head into main 2026-07-15 04:41:14 +00:00
anuna-02 commented 2026-07-15 02:44:49 +00:00 (Migrated from codeberg.org)

Implements the SPEC-005 vocabulary layer: a read-only projection over the
closure that names a theory's predicate families, their roles and
classification, their documentation, and a producer-side near-miss advisory —
plus the vocab and define CLI verbs. Also carries the SPEC-002 0.1.3
additive extension to the daemon append contract that ferries the advisory.

What's in it

  • core::vocab (pure core): family resolution (CON-402), the built-in
    registry (REQ-404), documentation records (REQ-402/CON-401), the vocabulary
    view (REQ-401/CON-403), redefinition provenance (REQ-407), and the near-miss
    advisory computation (REQ-406). Everything is a projection over an
    already-computed Closure — it never influences admission or conclusions.
  • CLI: elephant vocab (REQ-401 view surface) and elephant define
    (REQ-403 validating producer), plus the REQ-405 documentation join in
    why-not/require.
  • Daemon: the REQ-406 near-miss advisory on the append path, evaluated
    against a cached reference view before the append; the advisory rides the
    amended SPEC-002 CON-101 contract as a query parameter (?advice=false) so
    the request body stays byte-identical against pre-extension daemons.
  • Observability: OBS-401 advisory emissions, OBS-402 redefinition events,
    and daemon status counters.

Review hardening

Several adversarial and self-review rounds are folded in, each fixing verified
correctness gaps — e.g. bounding the witness-join to avoid an exponential
Cartesian blow-up (NFR-401), keeping the advisory-control query parse
infallible so a malformed value never fails the append (REQ-406), never
holding the reference-view lock across disk I/O, refreshing the reference view
after p2p sync, and making the sole-fact advisory gate count top-level forms.

CLI diagnostics fixes (this branch's tail)

Two user-visible CLI gaps found in an agent tour:

  • the daemon's {error, detail} body is now surfaced instead of an opaque
    "status code 400" (ureq drops the body on its own);
  • status no longer renders (not not X) (a double-negation the parser
    rejects), so a status line pastes cleanly into explain.

These pair with three companion fixes in spindle-rust
(explain/what-if/why-not diagnostics for variable-headed rules) already
merged there.

Verification

Full elephant suite: 199 passed, 2 ignored. cargo clippy --all-targets
clean; cargo fmt --check clean. Property tests cover family resolution and
merge-order determinism; the daemon advisory path has live end-to-end tests.

🤖 Generated with Claude Code

Implements the SPEC-005 vocabulary layer: a read-only projection over the closure that names a theory's predicate families, their roles and classification, their documentation, and a producer-side near-miss advisory — plus the `vocab` and `define` CLI verbs. Also carries the SPEC-002 0.1.3 additive extension to the daemon append contract that ferries the advisory. ## What's in it - **`core::vocab` (pure core):** family resolution (CON-402), the built-in registry (REQ-404), documentation records (REQ-402/CON-401), the vocabulary view (REQ-401/CON-403), redefinition provenance (REQ-407), and the near-miss advisory computation (REQ-406). Everything is a projection over an already-computed `Closure` — it never influences admission or conclusions. - **CLI:** `elephant vocab` (REQ-401 view surface) and `elephant define` (REQ-403 validating producer), plus the REQ-405 documentation join in `why-not`/`require`. - **Daemon:** the REQ-406 near-miss advisory on the append path, evaluated against a cached reference view before the append; the advisory rides the amended SPEC-002 CON-101 contract as a query parameter (`?advice=false`) so the request body stays byte-identical against pre-extension daemons. - **Observability:** OBS-401 advisory emissions, OBS-402 redefinition events, and `daemon status` counters. ## Review hardening Several adversarial and self-review rounds are folded in, each fixing verified correctness gaps — e.g. bounding the witness-join to avoid an exponential Cartesian blow-up (NFR-401), keeping the advisory-control query parse infallible so a malformed value never fails the append (REQ-406), never holding the reference-view lock across disk I/O, refreshing the reference view after p2p sync, and making the sole-fact advisory gate count top-level forms. ## CLI diagnostics fixes (this branch's tail) Two user-visible CLI gaps found in an agent tour: - the daemon's `{error, detail}` body is now surfaced instead of an opaque "status code 400" (ureq drops the body on its own); - `status` no longer renders `(not not X)` (a double-negation the parser rejects), so a status line pastes cleanly into `explain`. These pair with three companion fixes in `spindle-rust` (`explain`/`what-if`/`why-not` diagnostics for variable-headed rules) already merged there. ## Verification Full elephant suite: **199 passed, 2 ignored**. `cargo clippy --all-targets` clean; `cargo fmt --check` clean. Property tests cover family resolution and merge-order determinism; the daemon advisory path has live end-to-end tests. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
anuna-research/elephant!2
No description provided.