Skip to content

Claude/resume repos migration 9 o2 u1#31

Merged
hyperpolymath merged 4 commits into
mainfrom
claude/resume-repos-migration-9O2U1
Apr 20, 2026
Merged

Claude/resume repos migration 9 o2 u1#31
hyperpolymath merged 4 commits into
mainfrom
claude/resume-repos-migration-9O2U1

Conversation

@hyperpolymath

Copy link
Copy Markdown
Owner

Summary

Changes

RSR Quality Checklist

Required

  • Tests pass (just test or equivalent)
  • Code is formatted (just fmt or equivalent)
  • Linter is clean (no new warnings or errors)
  • No banned language patterns (no TypeScript, no npm/bun, no Go/Python)
  • No unsafe blocks without // SAFETY: comments
  • No banned functions (believe_me, unsafeCoerce, Obj.magic, Admitted, sorry)
  • SPDX license headers present on all new/modified source files
  • No secrets, credentials, or .env files included

As Applicable

  • .machine_readable/STATE.a2ml updated (if project state changed)
  • .machine_readable/ECOSYSTEM.a2ml updated (if integrations changed)
  • .machine_readable/META.a2ml updated (if architectural decisions changed)
  • Documentation updated for user-facing changes
  • TOPOLOGY.md updated (if architecture changed)
  • CHANGELOG or release notes updated
  • New dependencies reviewed for license compatibility (PMPL-1.0-or-later / MPL-2.0)
  • ABI/FFI changes validated (src/abi/ and ffi/zig/ consistent)

Testing

Screenshots

claude and others added 4 commits April 19, 2026 22:37
…bilities (Tasks #33 + #34)

Closes P0 backlog items #33 and #34 in docs/handover/COORD-MCP-TODO.md.
Version bumped to 0.7.0 (cartridge.json + cartridge.ncl + boj_cartridge_version).

Task #33 — client_kind extension + free-form variant label
- ClientKind enum: added openai (4) + mistral (5) in Zig FFI and Idris
  ABI (SafeLocalCoord.idr); KIND_COUNT bumped 4 → 6 for reject-ring.
- Peer struct gains `variant: [32]u8 + variant_len` (alphanumeric +
  `.`/`-`/`_` only). New FFI:
    coord_set_variant(token, variant)
    coord_read_peer_variant(peer_idx, out, cap)
- Adapter `coord_register` accepts optional `variant` and `capabilities`
  blocks — invalid values roll back the register so the caller sees a
  clean 400. `coord_list_peers` output now includes a `variant` field.
- Durable log: peer_variant_set = 15 (new event type), with
  logPeerVariantSet + decodePeerVariantSet and replay-dispatch wiring
  so slot reuse after crash reconstructs variant correctly.

Task #34 — capability advertisement for cold-start routing
- Per-peer storage: class_csv (≤128B), tier (0=unset, 1..5), and
  prover_strengths CSV (≤256B). CSV alphabets restricted to
  [A-Za-z0-9._-+/,] so later JSON rendering stays injection-safe.
- New FFI:
    coord_set_capabilities(token, class, tier, provers)
    coord_read_peer_class / _tier / _provers
- Adapter tools (cartridge.ncl + cartridge.json):
    coord_set_variant        — post-register update
    coord_set_capabilities   — post-register update
    coord_get_peer_capabilities
      — returns {peer_id, kind, variant, tier, class[], prover_strengths[]}
        using the server-rebuilt canonical peer_id rather than echoing
        client input.
- Durable log: peer_capabilities_set = 16 with matching encode + decode
  + replay-dispatch.

Tests
- Extended `default role derives from client_kind` to cover openai /
  mistral → apprentice.
- New `set and read peer variant (Task #33)` — round-trip, rejection of
  invalid chars, slot-reuse clears variant.
- New `set and read peer capabilities (Task #34)` — round-trip, tier
  out-of-range rejection retains prior value, bad CSV char (`"`)
  rejected.

Notes
- Build + e2e verification deferred: Zig is not on PATH in this
  environment. Pattern for every new code path mirrors established
  idioms in the same file (@memcpy slices, std.io.fixedBufferStream,
  std.mem.splitScalar, std.mem.writeInt with `buf[p_off..][0..2]`).
- cartridge.json was hand-synchronised; note the pre-existing drift
  from cartridge.ncl (extra tools from Tasks #13..#15, #32, #35 live
  in .json only). Regenerating from Nickel would currently delete
  them; kept surgical until Nickel toolchain is available.
- D3 in TODO says `just cartridge-install` in 007-lang is gated on
  these tasks shipping — that unblock now applies.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

https://claude.ai/code/session_01DobLJY3jgoso4M3z7xcZi8
From P1 in docs/handover/COORD-MCP-TODO.md. Single read-only tool that
returns a coord-wide snapshot so operators can monitor health without
walking every existing export individually.

Version → 0.8.0 (cartridge.json + cartridge.ncl + boj_cartridge_version).

FFI additions (all require a valid session token, -1 on bad token):
  coord_count_quarantine         — active quarantine entries
  coord_count_claims             — active task claims
  coord_count_track              — track-record ring fill
  coord_count_rejects_recent(k)  — rejects in the 10-min window for kind k
  coord_kind_in_cooldown(k)      — 1 if kind k is in reject-cooldown

Adapter:
  coord_health {token} → {
    peers:      { active, max, by_kind, by_role },
    quarantine: { pending, max },
    claims:     { active, max },
    track:      { entries, max },
    rejects:    { window_ms, cooldown_ms, recent_by_kind, in_cooldown: [...] }
  }
  Validates caller token via coord_count_rejects_recent(kind=0); first -1
  short-circuits to 401. Per-peer breakdown walks the 16 slots directly
  using the existing coord_read_peer_kind / _role exports.

Tests:
  `coord_health counts basics` — bad token → -1, valid token with one
  active claim reflects count, unseen kind has zero rejects, out-of-range
  kind returns -2.

Non-goals for this pass:
  - No historical / time-series data (spill to VeriSimDB is a separate
    P1 item).
  - No rate-limiting on the poll — loopback only, all callers are trusted
    session peers.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

https://claude.ai/code/session_01DobLJY3jgoso4M3z7xcZi8
Closes the last self-assessment layer. From P1 in
docs/handover/COORD-MCP-TODO.md, unblocks DD-9 in COORD-MCP-STATE.md.

Drift detector
--------------
The TODO criterion (`avg_confidence > 0.8 AND effective_affinity < 0.3`)
mechanically matches the existing overclaim heuristic, but the *intent*
is different: overclaim is a routing FYI, drift is a self-assessment
monitoring flag. They warrant distinct envelopes so the master sees
both signals without one drowning out the other.

`coord_scan_suggestions` now emits, on the same condition:
  - existing `kind:"overclaim"` — op_kind=fyi,  risk_tier=1 (routing)
  - new      `kind:"drift"`     — op_kind=warn, risk_tier=2 (monitoring)

The drift envelope additionally carries `drift_pct = avg_conf − pct`
so the master sees the magnitude of the gap at a glance.

kind_str fix
------------
Latent bug from Task #33: the engine-side `switch (agg.client_kind)` in
coord_scan_suggestions still mapped only kinds 0..2, falling through to
"custom" for openai/mistral peers. Extracted into a shared `kindStr`
helper that mirrors the adapter's `kindName` and now includes the new
kinds (4=openai, 5=mistral). All four suggestion emit branches use it.

Tests
-----
- Updated `scan flags overclaim` to also assert that a `kind:"drift"`
  envelope is emitted from the same condition, with `op_kind:"warn"`,
  risk_tier=2, and a `drift_pct` field.
- New `drift uses Task #33 kind names (openai)` — drift envelope from
  an openai peer now reports `client_kind:"openai"` rather than the
  fallback "custom".

Docs
----
- COORD-MCP-TODO.md: drift detector + coord_health crossed off in P1.
- COORD-MCP-STATE.md: DD-9 layer D moved from "pending P1" to "done"
  with implementation summary.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

https://claude.ai/code/session_01DobLJY3jgoso4M3z7xcZi8
@hyperpolymath hyperpolymath merged commit 100876c into main Apr 20, 2026
10 of 18 checks passed
@hyperpolymath hyperpolymath deleted the claude/resume-repos-migration-9O2U1 branch April 20, 2026 06:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants