Commit Graph
18 Commits
Author SHA1 Message Date
rUvandClaude Opus 4.5 2e19a09d4f Checkpoint: File edits
Automatic checkpoint created by Claude Code
- Branch: claude/guidance-control-plane-uhmR3
- Timestamp: 2026-02-02T03:48:06Z
- Changes: 1 file(s)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 03:48:06 +00:00
Claude 3e5f92ef8b security: eliminate hardcoded HMAC keys, fix timing attacks, remove command injection
- Remove hardcoded DEFAULT_SIGNING_KEY from proof.ts, artifacts.ts, evolution.ts
  Constructors now require explicit signingKey (fail-closed)
- Add timingSafeEqual() XOR-based constant-time comparison to proof.ts,
  artifacts.ts, authority.ts (prevents HMAC timing side-channels)
- Fix command injection in headless.ts: replace execFile('sh', ['-c', cmd])
  with direct arg-array execFile('claude', ['-p', prompt, ...])
- Fix command injection in analyzer.ts: same shell-free pattern
- Remove dead code: unused toLowerCase() in analyzer.ts extractMetrics
  and scoreCompleteness
- Hoist gates.ts GATE_DECISION_SEVERITY to module-level constant
- Add ConformanceRunner signingKey parameter for explicit key propagation
- Update tests: 3 new "should throw without key" assertions
- Add flight build report (docs/reports/flight-build-report.md)

1,331 tests passing.

https://claude.ai/code/session_01HLi9WmfvFgkDLJxLKGAUTf
2026-02-02 01:51:26 +00:00
Claude 671831dacd feat: add A/B benchmark harness with 20 tasks, gate simulation, and composite scoring
Implements the Measurement Plan: Config A (no control plane) vs Config B
(Phase 1 guidance) across 20 representative tasks from Claude Flow repo
history spanning 7 task classes (bug-fix, feature, refactor, security,
deployment, test, performance).

KPIs: success rate, tool calls, token spend, violations, human
interventions. Composite score formula:
score = success_rate - 0.1*cost - 0.2*violations - 0.1*interventions

Category shift detection: B beats A by ≥0.2 on composite across ≥3 task
classes. Gate simulation detects destructive commands, hardcoded secrets,
force push, unsafe types, skipped hooks, missing tests, policy violations.

1,328 tests passing across 26 files (38 new AB benchmark tests).

https://claude.ai/code/session_01HLi9WmfvFgkDLJxLKGAUTf
2026-02-01 22:22:17 +00:00
Claude 047bd1e562 feat: add content-aware executor, Spearman rho, and Cohen's d to validation suite
Fix fundamental flaw where mock executors were static and produced
identical adherence for before/after phases. The new
IContentAwareExecutor interface receives CLAUDE.md content via
setContext(), allowing executors to vary behavior based on guidance
quality. DifferentialMockExecutor analyzes content for security rules,
enforcement statements, build/test commands, and architecture sections
to produce realistic compliance variation.

Statistical improvements:
- Spearman rank correlation (non-parametric alternative to Pearson)
- Cohen's d effect size with interpretation labels
- Multi-trial averaging with majority-vote pass/fail
- Dual-correlation verdict using average of Pearson r and Spearman rho

1,290 tests passing across 26 files.

https://claude.ai/code/session_01HLi9WmfvFgkDLJxLKGAUTf
2026-02-01 21:28:08 +00:00
Claude 00018ac0dd feat: add empirical validation suite proving score-to-behavior correlation
Add validateEffect() that empirically measures whether score improvements
produce actual agent behavioral improvements:

- 15 compliance tasks covering all 6 scoring dimensions (Structure,
  Coverage, Enforceability, Compilability, Clarity, Completeness)
- Severity-weighted assertion evaluation (critical/major/minor)
- Per-dimension adherence rate computation
- Pearson correlation coefficient between score deltas and adherence deltas
- Per-dimension concordance analysis (did score and behavior move together?)
- Statistical significance testing with critical r-value tables
- Verdict classification: positive-effect, negative-effect, no-effect, inconclusive
- Formatted report with task breakdown, remaining failures, and interpretation
- Proof chain integration for tamper-evident audit trail
- Injectable executor interface for testing without real Claude CLI

1,278 tests passing across 26 test files.

https://claude.ai/code/session_01HLi9WmfvFgkDLJxLKGAUTf
2026-02-01 21:12:54 +00:00
Claude ebf7575af0 feat: add context-size-aware optimizer and headless Claude benchmarking
Add optimizeForSize() with compact/standard/full context presets that
restructure CLAUDE.md content through rule extraction, section splitting,
constitution trimming, and duplicate removal to achieve 88%+ scores.

Add headlessBenchmark() for automated compliance testing via claude -p
with injectable executor interface, proof chain verification, and
formatted before/after reports.

1,252 tests passing across 26 test files.

https://claude.ai/code/session_01HLi9WmfvFgkDLJxLKGAUTf
2026-02-01 21:02:44 +00:00
Claude e06f273a1b feat: add CLAUDE.md generators, analyzer, and auto-optimizer
Generators (src/generators.ts):
- generateClaudeMd() - structured CLAUDE.md from project profile with
  language-specific invariants (TS, JS, Python, Rust, Go, Java) and
  framework rules (React, Next.js, Express, Django, etc.)
- generateClaudeLocalMd() - CLAUDE.local.md for personal overrides
  with machine notes, editor prefs, and experimental rules
- generateSkillMd() - Claude Code skills with YAML frontmatter
- generateAgentMd() - Agent definitions with YAML frontmatter
- generateAgentIndex() - Agent index.yaml grouped by category
- scaffold() - Full .claude/ directory structure generation

Analyzer (src/analyzer.ts):
- 6-dimension scoring (0-100 each, weighted composite):
  Structure (20%), Coverage (20%), Enforceability (25%),
  Compilability (15%), Clarity (10%), Completeness (10%)
- benchmark() - before/after comparison with per-dimension deltas
- autoOptimize() - iteratively applies high-priority suggestions
  with concrete patches, re-scores to verify improvement
- formatReport() / formatBenchmark() - human-readable output

Analysis of existing CLAUDE.md files:
- Root CLAUDE.md: 73/100 (C) -> 77/100 after optimization
- v3/CLAUDE.md: 64/100 (D) -> 78/100 after optimization
- Key findings: low rule density, oversized constitution section,
  missing Architecture section

Tests: 141 new tests (68 generators + 73 analyzer), 1229 total passing

https://claude.ai/code/session_01HLi9WmfvFgkDLJxLKGAUTf
2026-02-01 20:48:36 +00:00
Claude 2dd2bb891f feat: add Rust WASM policy kernel with SIMD128 acceleration
Two-layer architecture: Layer A (Rust→WASM kernel for pure functions) +
Layer B (Node host bridge with transparent JS fallback).

Kernel modules:
- proof: SHA-256, HMAC-SHA256, content hashing, chain verification
- gates: secret scanning (8 patterns), destructive command detection (12 patterns)
- scoring: shard relevance scoring with domain/risk/keyword bonuses
- batch: 9-operation batch API to minimize WASM boundary crossings

Performance (SIMD128 enabled, 10k events):
- SHA-256 throughput: 1.80x faster (910k/s vs 505k/s)
- Secret scan (dirty): 1.96x faster (362k/s vs 185k/s)
- Secret scan (clean): 1.68x faster (676k/s vs 402k/s)
- Proof chain: 1.25x faster (61ms vs 76ms)

Includes:
- Pre-built wasm-pkg/ with SIMD+O2 optimization
- 15 acceptance tests (parity + 10k throughput benchmarks)
- ADR-G025 documenting architecture and performance
- README updated with WASM kernel docs and KPIs
- Wired exports into index.ts and package.json

https://claude.ai/code/session_01HLi9WmfvFgkDLJxLKGAUTf
2026-02-01 17:44:35 +00:00
Claude 20529c7f6f perf: add 22-benchmark suite with before/after report
Add comprehensive benchmark suite covering 11 modules:
- ContinueGate, ThreatDetector, CollusionDetector, MemoryQuorum
- Gateway, MemoryWriteGate, CoherenceScheduler, TrustAccumulator
- AuthorityGate, IrreversibilityClassifier, MetaGovernor

Key improvements vs commit a57ea60:
- CollusionDetector: +37% (1k interactions, single graph build)
- MemoryQuorum.propose: +73% (O(n) eviction vs O(n log n) sort)
- MemoryQuorum.vote+resolve: +186% (single-pass vote counting)
- Gateway.evaluate: +8% (batch cleanup interval)
- ContinueGate cooldown: -29% (intentional: safety checks added)

Additional optimization: MemoryQuorum.resolve() now counts votes
in a single pass instead of two Array.filter() calls.

Full suite: 23 files, 1073 tests passing.

https://claude.ai/code/session_01HLi9WmfvFgkDLJxLKGAUTf
2026-02-01 17:17:59 +00:00
Claude ce0da62054 fix: security hardening and performance optimization across 4 modules
Security fixes:
- continue-gate: check critical stop conditions (coherence, budget)
  during cooldown to prevent bypass via step timing
- gateway: add maxCacheSize (default 10k) to idempotency cache to
  prevent unbounded memory growth under high-throughput unique calls
- authority: add ReDoS protection to addPattern() — rejects nested
  quantifiers and enforces 500-char max pattern length

Performance fixes:
- adversarial: MemoryQuorum eviction from O(n log n) sort to O(n)
  linear min-find
- adversarial: CollusionDetector.detectCollusion() builds interaction
  graph once and passes to ring/frequency detectors (was rebuilding 3x)
- gateway: batch idempotency cache cleanup on 30s interval instead of
  every evaluate() call

Tests:
- Add 42-test continue-gate.test.ts covering all decision paths,
  cooldown bypass protection, history, stats, slope detection, and
  edge cases
- Full suite: 22 files, 1050 tests passing

https://claude.ai/code/session_01HLi9WmfvFgkDLJxLKGAUTf
2026-02-01 17:13:00 +00:00
Claude cfcb25b7d0 feat: add wave 3 civilization-grade primitives (trust, truth, uncertainty, time, authority, adversarial, meta-governance)
8 new modules with 4 test suites (332 new tests, 1008 total):
- trust.ts: per-agent trust accumulation, decay, tiers, rate multipliers
- truth-anchors.ts: immutable HMAC-signed external facts, conflict resolution
- uncertainty.ts: first-class belief tracking, confidence intervals, evidence
- temporal.ts: bitemporal assertions, validity windows, supersession chains
- authority.ts: human/institutional authority boundaries, irreversibility
- adversarial.ts: threat detection, collusion analysis, memory quorum
- meta-governance.ts: constitutional invariants, amendment lifecycle
- ruvbot-integration.ts: bridge to ruvbot AIDefence and memory adapter

README updated with all wave 3 modules, impact metrics, and architecture.

https://claude.ai/code/session_01HLi9WmfvFgkDLJxLKGAUTf
2026-02-01 14:32:40 +00:00
Claude ee3c182b79 feat: complete wave 2 with conformance kit, exports, ADRs, and README
- Add conformance-kit.ts: Memory Clerk acceptance test with SimulatedRuntime,
  MemoryClerkCell, and ConformanceRunner for replay verification
- Add manifest-validator.test.ts: 59 tests for fails-closed admission
- Add conformance-kit.test.ts: 42 tests for cell runtime and replay
- Wire all wave 2 modules into index.ts (capabilities, conformance-kit,
  proof, memory-gate, coherence)
- Add 8 new export paths to package.json (proof, memory-gate, coherence,
  artifacts, capabilities, evolution, conformance-kit)
- Write ADR-G010 through G016 covering capability algebra, artifact ledger,
  manifest validator, evolution pipeline, conformance kit,
  coherence-driven throttling, and agentic container integration
- Add package README with quantified impact, API reference, tutorials,
  architecture diagram, and full test matrix
- 639 tests passing across 17 test files

https://claude.ai/code/session_01HLi9WmfvFgkDLJxLKGAUTf
2026-02-01 12:04:55 +00:00
Claude db9cedc5ea feat: add manifest validator and evolution pipeline tests
Manifest validator: fails-closed admission checking for agent cell
manifests. Validates digest format, budget sanity, network allowlists,
risk scoring, and lane selection per the Agentic Container Spec v0.1.

Includes ConformanceSuite with golden trace validation and default
test traces for destructive commands, secrets, budget exceeded,
evidence-less writes, and valid operations.

https://claude.ai/code/session_01HLi9WmfvFgkDLJxLKGAUTf
2026-02-01 11:45:12 +00:00
Claude 4d68d8b47a feat: add capability algebra and evolution pipeline
Capability algebra: typed capability objects with grant, restrict,
delegate, expire, revoke, attest operations. Permissions are composable
data, not scattered config. Supports delegation chains, constraint
intersection, and subset checking.

Evolution pipeline: signed change proposals with simulation, replay
comparison, staged rollout, and automatic rollback on divergence.
Every change to rules/policies/tools follows:
propose → simulate → compare → stage → promote/rollback.

https://claude.ai/code/session_01HLi9WmfvFgkDLJxLKGAUTf
2026-02-01 11:44:31 +00:00
Claude c0e708a8d3 feat: add artifact ledger for signed production records
ArtifactLedger with HMAC-signed artifacts, content hashing, lineage
tracking, verification, and search. Every production output (code,
reports, datasets, memory deltas) is signed, versioned, and replayable.

https://claude.ai/code/session_01HLi9WmfvFgkDLJxLKGAUTf
2026-02-01 11:43:18 +00:00
Claude 794c489cf6 fix: hooks test secret pattern and agent refinements
- Update hooks test to use sk- pattern that survives JSON.stringify
- Agent refinements to persistence.ts and vitest.config.ts

All 379 tests passing across 12 test files.

https://claude.ai/code/session_01HLi9WmfvFgkDLJxLKGAUTf
2026-02-01 11:31:33 +00:00
Claude d43d6e1b22 feat: add wave 1 guidance primitives - proof, gateway, memory-gate, coherence, hooks, persistence
Seven concurrent agents built the core guidance control plane primitives:

- hooks.ts: GuidanceHookProvider wiring gates + retriever into
  HookRegistry lifecycle (PreCommand, PreToolUse, PreEdit, PreTask, PostTask)
- proof.ts: ProofChain with hash-chained envelopes, HMAC signing,
  tool call hashes, and memory lineage tracking
- gateway.ts: DeterministicToolGateway with idempotency cache,
  schema validation, and budget metering wrapping EnforcementGates
- memory-gate.ts: MemoryWriteGate with authority scope, rate limiting,
  TTL/decay, confidence scoring, and contradiction detection
- persistence.ts: PersistentLedger with NDJSON event storage,
  compaction, index maintenance, and file locking
- coherence.ts: CoherenceScheduler (drift detection, privilege throttling)
  and EconomicGovernor (token/tool/storage/time/cost budgets)
- Updated index.ts exports and package.json for new modules

Tests: 6 new test files covering all wave 1 components

https://claude.ai/code/session_01HLi9WmfvFgkDLJxLKGAUTf
2026-02-01 11:29:03 +00:00
Claude fab6d72ff8 feat: add @claude-flow/guidance control plane package
Implements a complete guidance control plane that sits beside Claude Code
to compile, retrieve, enforce, and optimize guidance rules.

Components:
- Compiler: Parses CLAUDE.md into constitution + shards + manifest
  with regex-based rule extraction, risk/intent/domain inference,
  and root/local overlay merging
- Retriever: Intent classifier with weighted pattern matching and
  shard retriever with hash-based embeddings, contradiction resolution,
  and diversity-aware selection
- Gates: 4 enforcement gates (destructive ops, tool allowlist,
  diff size, secrets) with configurable patterns and remediation
- Ledger: Run event logging with 5 built-in evaluators (tests pass,
  forbidden commands, forbidden deps, violation rate, diff quality)
- Optimizer: Weekly optimization loop with violation ranking, rule
  change proposals, A/B testing simulation, ADR generation, and
  promotion tracking (win-twice-to-promote)
- Headless: Test harness for Claude Code headless mode with task
  suites, assertion checking, and compliance testing
- CLI: guidance command with compile/retrieve/gates/status/optimize
  subcommands registered in CLI command index

Tests: 105 passing across 6 test files (compiler, retriever, gates,
ledger, optimizer, integration)

https://claude.ai/code/session_01HLi9WmfvFgkDLJxLKGAUTf
2026-02-01 10:58:53 +00:00