Skip to content

Audit agent architecture and remove legacy rule injector - #66

Merged
dollspace-gay merged 191 commits into
mainfrom
agent/refactor-agent-system-remediation
Aug 31, 2026
Merged

dollspace-gay merged 191 commits into
mainfrom
agent/refactor-agent-system-remediation

Conversation

@dollspace-gay

@dollspace-gay dollspace-gay commented Aug 17, 2026 •

Copy link
Copy Markdown
Member

What changed

  • Replaces fragmented and stale audit/design Markdown with a complete file-by-file codebase audit, one canonical production-remediation design, and 102 small-to-medium actionable remediation slices.
  • Implements S-007 by removing the deprecated filesystem rule injector from every runtime frontend, initialization path, configuration surface, hook, and positive test.
  • Implements S-008 by replacing raw prompt concatenation with typed context provenance, authority, sensitivity, freshness, hard budgets, deterministic truncation, and trace receipts.
  • Implements S-009 by making repository hook discovery inert until an exact host approval is recorded, adding digest-bound status/approve/revoke commands, and replacing the inherited persona/tool monolith with minimal capability-neutral host policy.
  • Implements S-010 as a replayable canonical run/event kernel with typed identities, immutable workspace/capability/budget/provider bindings, a run-scoped cancellation tree, acknowledged trace commits, and fail-closed terminal outcomes.
  • Migrates main/TUI, REPL, print mode, ACP, proxy, subagents, provider request construction, hooks, VDD advisory output, output style, memory/skills/project/IDE context, Reality grounding, plugin metadata, and web-fetch distillation through the typed boundary.
  • Preserves operational hooks, user-approved plans, user-owned output styles, provider-native tool results, skills, permissions, sandboxing, plugins, and direct user instructions while preventing repository, tool, hook, verifier, and compaction text from silently gaining system authority.
  • Documents the rotating planner/fresh-worker architecture and a VDD verifier with the same harness, guardrails, and reality-grounding capabilities.

Why

Repeated rewrites left product claims, incomplete features, duplicated documents, and unsafe or misleading agent-system behavior out of sync with the implementation. The old prompt path treated unrelated strings as trusted based on concatenation position or XML-like wrappers, had no hard context budget, and allowed model-authored compaction/VDD or hook text to reach system authority. Repository hook settings also activated merely because recognized files existed. This branch establishes an evidence-backed baseline and an ordered repair program. Only the legacy rule injector, a duplicate stale behavioral prompt, obsolete unsafe APIs/tests, ambient repository authority, and genuinely stale documentation/artifacts are removed; operational features are retained or repaired.

User-visible impact

  • Repository rule files are no longer injected into model context, and openclaudia init no longer creates rule files.
  • Repository-local .openclaudia/output-style.md is ignored; user-owned ~/.openclaudia/output-style.md remains supported as bounded confidential user instruction input.
  • Repository .openclaudia/config.yaml hooks and .claude/settings*.json hooks are now inert proposals. openclaudia hooks status shows canonical source, source/proposal digests, requested events/effects, commands, and bound source files; exact approve/revoke commands manage host-owned receipts.
  • Approved repository hooks remain direct-spawn, full-sandbox actions. Settings or bound source mutation requires reapproval; generated Python cache files do not invalidate receipts; native/user/managed host hooks retain higher authority.
  • Hooks continue to run, deny, and report observations, but hook-authored prompt/system fields are bounded reference data and a deny suppresses all model-visible output.
  • The base prompt no longer claims a fixed Claudia identity, static tools, XML invocation syntax, browser access, chainlink availability, or permissions. Runtime-attached tool schemas are authoritative.
  • Explicitly user-approved plans retain user instruction authority. VDD findings, Reality packets, IDE/project/memory/skill/web data, and compaction summaries are source-labeled reference data.
  • Web-fetch distillation now bounds and labels the model/tool query and fetched page separately; only the compiled distillation policy is a system instruction.
  • Provider-native tool/MCP/web results retain their role and call IDs and cannot be promoted by marker-shaped content.
  • Current product surfaces remain documented with explicit caveats where later remediation slices still own production completion.
  • The new runtime kernel rejects committed success after cancellation, partial failure, active calls, or uncommitted state. Existing frontends remain operational and deliberately unmigrated until their dependent slices adopt the kernel.

Validation

S-007:

  • cargo clean in the root and fuzz crates
  • 65 focused rule-removal, output-style, and initialization tests
  • Independent fresh-context review: PASS, no blocking findings
  • Artifact generation: sha256:0d3b75a6d4f8f06ab0d9841f0fe9c0cf05d48e0f37fa14425265e5b59bf87a16

S-008:

  • cargo check --workspace --all-targets --all-features
  • cargo fmt --all -- --check
  • cargo clippy --workspace --all-targets --all-features -- -D warnings -A clippy::large_enum_variant (the one waiver is the pre-existing out-of-scope TUI event enum)
  • 9 typed-context unit tests, 10 prompt authority/budget integration tests, 96 hook/VDD/output-style/provider targeted tests, 2 live web-distillation provenance tests, and 2 proxy authority regressions
  • Removed-API/residual system-role audit and git diff --check
  • cargo test --workspace --all-features -- --test-threads=1: zero failures across 2,624 library tests, 215 binary tests, every integration target, and doc tests; explicitly network/browser-dependent tests remained ignored
  • Artifact generation: sha256:7a83e0db4aadcc6a1e7f261440cb2954bfd8c7a3811e3509dfee6d85647898ea

S-009:

  • cargo fmt --all -- --check, JSON/Python syntax validation, and git diff --check
  • CARGO_BUILD_JOBS=1 cargo check --workspace --all-targets --all-features
  • CARGO_BUILD_JOBS=1 cargo clippy --workspace --all-targets --all-features -- -D warnings -A clippy::large-enum-variant
  • 13 repository-import trust tests, 18 Claude compatibility tests, 10 typed-prompt integration tests, 3 prompt unit tests, and the complete 61-test CLI contract suite
  • Live tracked proposal trace displayed exact source/proposal digests, three events, six effects, three direct-spawn commands, and four bound source files while remaining pending/inert
  • CARGO_BUILD_JOBS=1 cargo test --workspace --all-features -- --test-threads=1: zero failures across 2,624 library tests, every integration target, and doc tests; explicitly network-dependent tests remained ignored
  • Artifact generation: sha256:6a2337d90765bdf953fdeb5a7b6a7eeaa012a247efd37f6e84c59f29d24157cd

S-010:

  • CARGO_BUILD_JOBS=1 cargo check --workspace --all-targets --all-features
  • CARGO_BUILD_JOBS=1 cargo clippy --workspace --all-targets --all-features -- -D warnings -A clippy::large_enum_variant
  • 12 focused runtime-kernel tests covering typed replay, cancellation propagation/isolation, foreign receipts, forbidden-success states, terminal uniqueness, trace rejection, and explicit workspace/trace budgets
  • CARGO_BUILD_JOBS=1 cargo test --workspace --all-features -- --test-threads=1: zero failures across 2,624 library tests, every integration target, and doc tests; explicitly network/browser-dependent tests remained ignored
  • Artifact generation: sha256:9b3a2831dc5e9f3e360c3ec7c6a289a971e9cfaedd186fdf970fe2049c2d7c0d

Canonical alternate-model VDD remains explicitly queued until S-088 implements that verifier role. S-007, S-008, S-009, and S-010 are recorded as implemented with deterministic verification, not falsely marked as canonically VDD-verified. The PR remains draft while subsequent remediation slices are added to this branch.

@dollspace-gay dollspace-gay self-assigned this Aug 17, 2026
dollspace-field and others added 27 commits August 16, 2026 22:23
Make effect declarations mandatory across registry, subagent, MCP, and unavailable plugin surfaces. Replace opaque Crosslink argv dispatch with typed operations and fail closed for unknown or malformed calls.
Migrate tracked legacy Chainlink state to canonical Crosslink project configuration, register Claude/Codex MCP integrations, and ignore generated Python bytecode and runtime artifacts.
Make hard and explicit denials dominate narrow, expiring approval authority across every frontend. Bind one-use execution permits to the exact normalized call, store reusable receipts only in trusted bounded host state, and serialize permit consumption with concurrent revocation.
Enforce a generation-bound host ceiling and exact dispatch permits across every canonical tool entry point. Separate repository permission proposals from trusted host authority, preserve typed failures, and harden sandbox cancellation discovered during adversarial verification.
Remove ambient session authority across dispatch, files, processes, hooks, MCP, prompts, plugins, approvals, and frontend lifecycle boundaries. Add exact-run adversarial coverage, secure plan/control storage, lifecycle retirement evidence, and the completed S-019 artifact receipt.
Capture the host-home toolchain root at run composition, include it in the capability manifest, and preserve it across derived runs instead of consulting ambient HOME during sandbox execution. Strengthen the Linux probe to exercise the exact run-resolved Cargo mount on hosted runners.
Remove shell-string auto-approval and the lexical path authority gate. Keep Bash behind explicit policy and enforce filesystem access in the run-bound OS sandbox, with adversarial dispatch and containment evidence recorded in S-020.
Restore the last machine-maintained changelog state and replay normal issue-close events with Crosslink's exact category, ordering, and multiplicity semantics. Preserve explicit --no-changelog closures.
Replace process-global turn counters with exact-run atomic effect, mutation, line, and canonical-resource reservations. Preserve uncertain started effects as typed partial outcomes and enforce recursive disclosure policy before returning paths.
Introduce a generation-bound, descriptor-relative Unix persistence capability with typed durability and recovery receipts. Preserve session compatibility, strengthen diagnostic path feedback, and document adversarial verification and platform queues for S-031.
Wire fresh semantic workers, effective ACP capability generations, and canonical proxy route lifecycles. Preserve native provider state and worker artifacts, rebind generated retrieval evidence, and allow normal trusted-driver Git operations while retaining destructive guards.\n\nRefs #1166 #1167 #1168 #1169 #1170 #1171
Run worktree discovery and lifecycle tests against disposable Git repositories instead of the live checkout and its shared .worktrees directory. Preserve the production sandbox and cleanup behavior while making primary and linked checkout execution deterministic.\n\nRefs #1055
Use the disposable repository capability for the main-worktree exit refusal test and require the exact safety error. This removes the final ambient linked-checkout dependency found by detached-worktree verification.\n\nRefs #1055
Preserve the Crosslink-generated closure entry for #1055 verbatim.\n\nRefs #1173
Keep supervised stdin delivery strict by default, but let command hooks opt into an explicit early-close policy. Record incomplete delivery truthfully while preserving the child exit status, timeout, cancellation, output, and sandbox contracts.\n\nFixes #1174
Preserve the Crosslink-generated closure entry for #1174 verbatim.\n\nRefs #1175
Wire generation-bound plugin capabilities through production frontends, replace the synthetic keybinding path with the shared contextual resolver, and add the host-only alternate-model verifier role. Preserve exact Crosslink changelog output and regenerate cited technical-memory evidence for the final source generation.
Update the main and fuzz lock graphs from yanked chacha20 0.10.1 to the compatible 0.10.2 patch so fresh-index repository policy checks remain enforceable.
Use one artifact-bound verifier ledger, retain transport-observed model identity, join verifier-owned process work, deliver digest-bound source snapshots, and exercise the real child/tool harness end to end. Preserve the generated Crosslink changelog and rebound technical-memory evidence.
Complete S-084, S-085, and S-095 under parent issue #1188. Production-wire durable authorized schedules, measured read speculation, and protocol-correct proxy streaming with honest VDD delivery semantics.
Introduce the strict versioned verdict contract, bind finding identities and locations to current reality evidence, and reject malformed or contradictory terminal output. Keep heuristic duplicate and pattern matches advisory so only evidence-backed verification can demote a finding.\n\nRefs: #1196
Make VDD publication host-owned and fail closed across text and worker frontends, while bounding provider calls, subprocesses, usage, and cancellation. Preserve Crosslink closure output and regenerate the exact retrieval-evidence binding for the changed main entrypoint.\n\nCloses #1197 and #1198.
Bind redacted VDD ledgers and Crosslink reconciliation to the host's canonical finalization receipt, exact artifact generation, and task scope. Add retention-aware export/deletion, crash-safe idempotent issue projection, capability-safe storage, and focused recovery tests.\n\nCloses S-102 (#1199).
Complete S-038 session ownership migration, S-058 explicit hook import trust, and S-075 shared typed command registry. Preserve foreign state as bounded imports, keep repository hooks inert until exact host approval, and route CLI/TUI command admission through one registry.
Publish background job completion only after command evidence, freshness generation, and verifier receipt invalidation are settled. This removes the Linux CI race where bash_output reported finished while verification still observed an in-flight mutation.
Poll the actual terminal lifecycle contract instead of assuming twenty jobs settle within 600 ms. Rebind the cited supervisor source, regenerate the retrieval evaluation, and keep the exact independent review rejected.
Deliver S-089 session and call isolation, S-092 authenticated proxy admission, and S-096 launch-scoped TUI cancellation and shutdown. Rebind the S-105 technical-memory evidence after the cited main source changed.
@dollspace-gay dollspace-gay added the enhancement New feature or request label Aug 30, 2026
Deliver S-090 bounded ACP transport, S-093 authenticated proxy session isolation, and S-097 descriptor-bound TUI attachment projection. Preserve Crosslink-generated closure entries and record Rust 1.98 verification evidence.
Complete S-060, S-061, and S-098 with canonical hook admission, scoped plugin identity and bounded discovery, and generation-bound provider transitions. Reconcile stale remediation status documents and refresh retrieval evidence for the changed runtime source.
Deliver S-076, S-077, and S-083 with generation-bound transactions, least-privilege Git publication, and bounded inert terminal rendering.\n\nCloses #1221.\nCloses #1222.\nCloses #1223.
Use libc::mode_t at the descriptor-relative mkdirat boundary so transactional initialization compiles on Linux and macOS.\n\nCloses #1224.
Complete S-039, S-049, and S-079 with causal resume and branch identity, reasoning privacy boundaries, and capability-backed legacy attachments and editor input. Includes root reconciliation fixes, updated evidence artifacts, and Crosslink-generated changelog entries.\n\nRefs: #1226, #1227, #1228
Route print execution through the bounded canonical runtime and give private notes and side questions local causal semantics. Rebind the generated retrieval evidence for the shared entrypoint change.\n\nRefs #1230 and #1231.
Make plan approval an immutable artifact-bound transition, enforce its effect ceiling at tool admission, and invalidate stale authority across edits, cancellation, mode changes, and successor runs.

Refs #1232
@dollspace-gay
dollspace-gay marked this pull request as ready for review August 31, 2026 01:36
@dollspace-gay
dollspace-gay merged commit fad337c into main Aug 31, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants