项目文件夹

文件
wehub-resource-sync 23f7624596
ADR-166 MCP Bridge Security Lock / Static-source security lock (push) Failing after 0s
ADR-166 MCP Bridge Security Lock / Compose default binds loopback + Mongo has auth (push) Failing after 2s
CodeQL Advanced / Analyze (rust) (push) Failing after 0s
ADR-166 MCP Bridge Security Lock / plugin-agent-federation bindHost default (push) Failing after 1s
ADR-166 MCP Bridge Security Lock / Runtime behavior — 401 + terminal gate + fail-closed (push) Failing after 4s
business-pods-smoke / smoke (push) Failing after 1s
all-plugins-smoke / smoke-all (push) Failing after 2s
CI/CD Pipeline / Security & Code Quality (push) Failing after 1s
CI/CD Pipeline / Test Suite (ubuntu-latest) (push) Failing after 1s
CI/CD Pipeline / Build & Package (macos-latest) (push) Has been skipped
CI/CD Pipeline / Build & Package (ubuntu-latest) (push) Has been skipped
CI/CD Pipeline / Build & Package (windows-latest) (push) Has been skipped
CI/CD Pipeline / Documentation & Examples (push) Failing after 1s
Clone Tracker (14-day rolling) / Snapshot clones for ruflo ecosystem (push) Failing after 1s
CodeQL Advanced / Analyze (actions) (push) Failing after 1s
CodeQL Advanced / Analyze (javascript-typescript) (push) Failing after 1s
federation-peer-rust / stable-noop (push) Failing after 1s
metaharness-ci / score (push) Failing after 1s
metaharness-ci / router-compat (push) Failing after 0s
metaharness-ci / similarity-tests (push) Failing after 0s
no-agentbbs-smoke / smoke-without-agentbbs (push) Failing after 1s
V3 CI/CD Pipeline / Build V3 (windows-latest) (push) Has been skipped
codex-integration-audit / Codex integration audit (push) Failing after 1s
helpers-manifest-guard / guard (push) Failing after 1s
🔗 Cross-Agent Integration Tests / 🤝 Agent Coordination Tests (push) Has been skipped
🔗 Cross-Agent Integration Tests / 🧠 Memory Sharing Integration (push) Has been skipped
🔗 Cross-Agent Integration Tests / 🛡️ Fault Tolerance Tests (push) Has been skipped
🔗 Cross-Agent Integration Tests / ⚡ Performance Integration Tests (push) Has been skipped
metaharness-ci / mcp-scan (push) Failing after 1s
metaharness-ci / eject-dryrun (push) Failing after 1s
metaharness-ci / metaharness-real-data (push) Failing after 0s
no-cli-optdep-bloat-2561 / guard (push) Failing after 1s
no-metaharness-smoke / smoke-without-metaharness (push) Failing after 1s
no-phantom-agentic-flow-subpath / guard (push) Failing after 1s
🔄 Automated Rollback Manager / 🚨 Failure Detection (push) Failing after 1s
V3 CI/CD Pipeline / Plugin hooks smoke / ubuntu-latest / Node 22 (push) Failing after 1s
V3 CI/CD Pipeline / ruflo-graph-intelligence build + test smoke (#2044, ADR-123) (push) Failing after 1s
CVE Audit Gate / Audit root (critical-blocking) (push) Failing after 2s
cost-tracker-smoke / smoke (push) Failing after 3s
oia-audit-weekly / audit (push) Failing after 2s
ruflo-agent-smoke / ruflo-agent structural smoke (push) Failing after 1s
📊 Status Badges Update / 📊 Update Status Badges (push) Failing after 1s
V3 CI/CD Pipeline / Static regression guards (#2267 YAML + (push) Failing after 1s
V3 CI/CD Pipeline / Test V3 Packages (push) Failing after 0s
V3 CI/CD Pipeline / agent_execute provider routing smoke (#2042) (push) Failing after 0s
CVE Audit Gate / Audit v3 (critical-blocking) (push) Failing after 1s
federation-peer-rust / stable-native (push) Failing after 2s
🔗 Cross-Agent Integration Tests / 🚀 Integration Test Setup (push) Failing after 2s
neural-trader-smoke / runtime-smoke (push) Failing after 1s
V3 CI/CD Pipeline / Build V3 (macos-latest) (push) Has been skipped
V3 CI/CD Pipeline / Build V3 (ubuntu-latest) (push) Has been skipped
V3 CI/CD Pipeline / Type Check V3 (push) Failing after 1s
V3 CI/CD Pipeline / Smoke (no better-sqlite3) / ubuntu-latest / Node 24 (push) Failing after 1s
V3 CI/CD Pipeline / Smoke (no better-sqlite3) / ubuntu-latest / Node 22 (push) Failing after 2s
V3 CI/CD Pipeline / browser rvf create flag smoke (#2015) (push) Failing after 0s
V3 CI/CD Pipeline / Dependency review (#2046) (push) Has been skipped
V3 CI/CD Pipeline / Supply-chain audit (#2046) (push) Failing after 0s
V3 CI/CD Pipeline / witness marker drift smoke (#2021) (push) Failing after 1s
V3 CI/CD Pipeline / neural-trader portfolio CG smoke (#2068, ADR-126 Phase 3) (push) Failing after 1s
V3 CI/CD Pipeline / neural-trader backtest signing smoke (#2068, ADR-126 Phase 4) (push) Failing after 1s
V3 CI/CD Pipeline / kg-extract type-import classification smoke (#2049) (push) Failing after 0s
V3 CI/CD Pipeline / witness verify precondition smoke (#1880) (push) Failing after 2s
V3 CI/CD Pipeline / neural-trader pipeline risk-gate smoke (#2068, ADR-126 Phase 5) (push) Failing after 0s
V3 CI/CD Pipeline / neural-trader feature attribution smoke (#2068, ADR-126 Phase 6) (push) Failing after 0s
V3 CI/CD Pipeline / plugin-registry signature verification smoke (#1922, CWE-347) (push) Failing after 4s
V3 CI/CD Pipeline / memory stats legacy-DB smoke (#2120) (push) Failing after 4s
V3 CI/CD Pipeline / github deprecated actions smoke (#2089, ADR-127 Phase 3) (push) Failing after 1s
V3 CI/CD Pipeline / graph query + pathfinder smoke (ADR-130 P2+P5) (push) Has been skipped
V3 CI/CD Pipeline / graph trajectory hooks smoke (ADR-130 P3) (push) Has been skipped
V3 CI/CD Pipeline / graph plugin adapter smoke (ADR-130 P4) (push) Has been skipped
V3 CI/CD Pipeline / graph benchmark (ADR-130 P6) (push) Has been skipped
V3 CI/CD Pipeline / statusline generator delegation smoke (#2195) (push) Failing after 1s
V3 CI/CD Pipeline / wizard init regression guard (#2206 (push) Failing after 1s
V3 CI/CD Pipeline / memory no-stray-db smoke (ADR-125 P7) (push) Failing after 1s
V3 CI/CD Pipeline / github-safe injection smoke (#2089, ADR-127 Phase 1) (push) Failing after 1s
V3 CI/CD Pipeline / github actions pin smoke (#2089, ADR-127 Phase 1) (push) Failing after 1s
V3 CI/CD Pipeline / github attribution opt-in smoke (#2089, ADR-127 Phase 4) (push) Failing after 1s
V3 CI/CD Pipeline / pre-bash hook safety smoke (#2017) (push) Failing after 1s
V3 CI/CD Pipeline / Memory import smoke / ubuntu-latest (push) Failing after 0s
V3 CI/CD Pipeline / MCP protocol smoke / ubuntu-latest (push) Failing after 2s
V3 CI/CD Pipeline / ruvllm WASM auto-init smoke (#2086) (push) Failing after 4s
V3 CI/CD Pipeline / MCP paired-tool round-trip smoke (#1889) (push) Failing after 1s
V3 CI/CD Pipeline / Plugin package install-safety (#1902/#1903/#1904) (push) Failing after 1s
V3 CI/CD Pipeline / Tool description discoverability (ADR-112) (push) Failing after 3s
V3 CI/CD Pipeline / CLI npx-install smoke (#1147 / (22) (push) Failing after 1s
V3 CI/CD Pipeline / CLI npx-install smoke (#1147 / (24) (push) Failing after 1s
V3 CI/CD Pipeline / Windows hook shim smoke (#2132) / ubuntu-latest (push) Failing after 2s
V3 CI/CD Pipeline / Windows hook execution smoke (#2132) / ubuntu-latest (push) Failing after 1s
V3 CI/CD Pipeline / Windows init hooks smoke (#2132) / ubuntu-latest (push) Failing after 1s
V3 CI/CD Pipeline / Vector-index dimension audit (#1947) (push) Failing after 0s
V3 CI/CD Pipeline / Hook-command install safety (#1921) (push) Failing after 1s
V3 CI/CD Pipeline / ToolOutputGuardrail smoke (ADR-131, (push) Failing after 1s
V3 CI/CD Pipeline / init-bundle invariants smoke (#2095, ADR-128 Phase 5) (push) Failing after 1s
V3 CI/CD Pipeline / wasm provider bridge smoke (ADR-129 P1) (push) Failing after 2s
V3 CI/CD Pipeline / wasm gallery CRUD smoke (ADR-129 P3) (push) Failing after 1s
V3 CI/CD Pipeline / wasm plugin bridge smoke (ADR-129 P4) (push) Failing after 0s
V3 CI/CD Pipeline / wasm compose smoke (ADR-129 P2) (push) Failing after 4s
V3 CI/CD Pipeline / graph schema smoke (ADR-130 P1) (push) Failing after 0s
Validate Marketplace / validate (push) Failing after 1s
🔍 Verification Pipeline / 🚀 Setup Verification (push) Failing after 1s
🔍 Verification Pipeline / 🛡️ Security Verification (push) Has been skipped
🔍 Verification Pipeline / 📝 Code Quality (push) Has been skipped
🔍 Verification Pipeline / 🧪 Test Verification (${{ matrix.os }}, Node ${{ matrix.node }}) (push) Has been skipped
🔍 Verification Pipeline / 🏗️ Build Verification (push) Has been skipped
🔍 Verification Pipeline / 📚 Documentation Verification (push) Has been skipped
CVE Audit Gate / High-severity report (warn only) (push) Has been cancelled
🔄 Automated Rollback Manager / 🔄 Execute Rollback (push) Has been cancelled
🔄 Automated Rollback Manager / ✅ Post-Rollback Verification (push) Has been cancelled
🔄 Automated Rollback Manager / 📊 Rollback Monitoring (push) Has been cancelled
V3 CI/CD Pipeline / Windows init hooks smoke (#2132) / windows-latest (push) Has been cancelled
V3 CI/CD Pipeline / Windows hook execution smoke (#2132) / macos-latest (push) Has been cancelled
V3 CI/CD Pipeline / Windows hook execution smoke (#2132) / windows-latest (push) Has been cancelled
🔄 Automated Rollback Manager / ⏳ Manual Rollback Approval (push) Has been cancelled
V3 CI/CD Pipeline / MCP protocol smoke / macos-latest (push) Has been cancelled
V3 CI/CD Pipeline / Memory import smoke / macos-latest (push) Has been cancelled
V3 CI/CD Pipeline / Windows hook shim smoke (#2132) / macos-latest (push) Has been cancelled
V3 CI/CD Pipeline / Windows hook shim smoke (#2132) / windows-latest (push) Has been cancelled
V3 CI/CD Pipeline / Windows init hooks smoke (#2132) / macos-latest (push) Has been cancelled
V3 CI/CD Pipeline / Witness verify (signed manifest) / macos-latest (push) Has been cancelled
V3 CI/CD Pipeline / Witness verify (signed manifest) / ubuntu-latest (push) Has been cancelled
V3 CI/CD Pipeline / Witness verify (signed manifest) / windows-latest (push) Has been cancelled
V3 CI/CD Pipeline / Publish to npm (alpha) (push) Has been cancelled
V3 CI/CD Pipeline / Smoke (no better-sqlite3) / macos-latest / Node 22 (push) Has been cancelled
V3 CI/CD Pipeline / Plugin hooks smoke / macos-latest / Node 22 (push) Has been cancelled
CI/CD Pipeline / Deploy & Release (push) Has been cancelled
CI/CD Pipeline / CI Status (push) Has been cancelled
🔗 Cross-Agent Integration Tests / 📊 Integration Test Report (push) Has been cancelled
🔄 Automated Rollback Manager / 🔍 Pre-Rollback Validation (push) Has been cancelled
🔍 Verification Pipeline / ⚡ Performance Verification (push) Has been cancelled
🔍 Verification Pipeline / 📊 Verification Report (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 12:02:19 +08:00

475 行
18 KiB
Markdown

此文件含有模棱两可的 Unicode 字符
此文件含有可能会与其他字符混淆的 Unicode 字符。 如果您是想特意这样的,可以安全地忽略该警告。 使用 Escape 按钮显示他们。
# API Quick Reference
All exports from `@claude-flow/guidance`. Each module is also available as a standalone import.
## Import Map
| Import Path | Key Exports |
|-------------|-------------|
| `@claude-flow/guidance` | `GuidanceControlPlane`, `createGuidanceControlPlane` |
| `@claude-flow/guidance/compiler` | `GuidanceCompiler`, `createCompiler` |
| `@claude-flow/guidance/retriever` | `ShardRetriever`, `createRetriever`, `HashEmbeddingProvider` |
| `@claude-flow/guidance/gates` | `EnforcementGates`, `createGates` |
| `@claude-flow/guidance/hooks` | `GuidanceHookProvider`, `createGuidanceHooks` |
| `@claude-flow/guidance/ledger` | `RunLedger`, `createLedger`, `TestsPassEvaluator`, `ForbiddenCommandEvaluator`, `ForbiddenDependencyEvaluator`, `ViolationRateEvaluator`, `DiffQualityEvaluator` |
| `@claude-flow/guidance/optimizer` | `OptimizerLoop`, `createOptimizer` |
| `@claude-flow/guidance/persistence` | `PersistentLedger`, `EventStore`, `createPersistentLedger`, `createEventStore` |
| `@claude-flow/guidance/headless` | `HeadlessRunner`, `createHeadlessRunner`, `createComplianceSuite` |
| `@claude-flow/guidance/gateway` | `DeterministicToolGateway`, `createToolGateway` |
| `@claude-flow/guidance/artifacts` | `ArtifactLedger`, `createArtifactLedger` |
| `@claude-flow/guidance/evolution` | `EvolutionPipeline`, `createEvolutionPipeline` |
| `@claude-flow/guidance/manifest-validator` | `ManifestValidator`, `ConformanceSuite`, `createManifestValidator`, `createConformanceSuite` |
| `@claude-flow/guidance/proof` | `ProofChain`, `createProofChain` |
| `@claude-flow/guidance/memory-gate` | `MemoryWriteGate`, `createMemoryWriteGate`, `createMemoryEntry` |
| `@claude-flow/guidance/coherence` | `CoherenceScheduler`, `EconomicGovernor`, `createCoherenceScheduler`, `createEconomicGovernor` |
| `@claude-flow/guidance/capabilities` | `CapabilityAlgebra`, `createCapabilityAlgebra` |
| `@claude-flow/guidance/conformance-kit` | `SimulatedRuntime`, `MemoryClerkCell`, `ConformanceRunner`, `createMemoryClerkCell`, `createConformanceRunner` |
| `@claude-flow/guidance/ruvbot-integration` | `RuvBotGuidanceBridge`, `AIDefenceGate`, `RuvBotMemoryAdapter`, `createRuvBotBridge`, `createAIDefenceGate`, `createRuvBotMemoryAdapter` |
| `@claude-flow/guidance/meta-governance` | `MetaGovernor`, `createMetaGovernor` |
| `@claude-flow/guidance/adversarial` | `ThreatDetector`, `CollusionDetector`, `MemoryQuorum`, `createThreatDetector`, `createCollusionDetector`, `createMemoryQuorum` |
| `@claude-flow/guidance/trust` | `TrustAccumulator`, `TrustScoreLedger`, `TrustSystem`, `getTrustBasedRateLimit`, `createTrustAccumulator`, `createTrustSystem` |
| `@claude-flow/guidance/truth-anchors` | `TruthAnchorStore`, `TruthResolver`, `createTruthAnchorStore`, `createTruthResolver` |
| `@claude-flow/guidance/uncertainty` | `UncertaintyLedger`, `UncertaintyAggregator`, `createUncertaintyLedger`, `createUncertaintyAggregator` |
| `@claude-flow/guidance/temporal` | `TemporalStore`, `TemporalReasoner`, `createTemporalStore`, `createTemporalReasoner` |
| `@claude-flow/guidance/authority` | `AuthorityGate`, `IrreversibilityClassifier`, `createAuthorityGate`, `createIrreversibilityClassifier`, `isHigherAuthority`, `getAuthorityHierarchy` |
| `@claude-flow/guidance/continue-gate` | `ContinueGate`, `createContinueGate` |
| `@claude-flow/guidance/wasm-kernel` | `getKernel`, `isWasmAvailable`, `resetKernel` |
| `@claude-flow/guidance/generators` | `generateClaudeMd`, `generateClaudeLocalMd`, `generateSkillMd`, `generateAgentMd`, `generateAgentIndex`, `scaffold` |
| `@claude-flow/guidance/analyzer` | `analyze`, `benchmark`, `autoOptimize`, `optimizeForSize`, `headlessBenchmark`, `validateEffect`, `abBenchmark`, `getDefaultABTasks`, `formatReport`, `formatBenchmark` |
---
## GuidanceControlPlane
The all-in-one orchestrator.
```ts
const plane = createGuidanceControlPlane(config?)
await plane.initialize()
```
| Method | Returns | Description |
|--------|---------|-------------|
| `initialize()` | `Promise<void>` | Read CLAUDE.md, compile, load shards, activate gates |
| `compile(root, local?)` | `Promise<PolicyBundle>` | Compile without reading files |
| `retrieveForTask(request)` | `Promise<RetrievalResult>` | Get constitution + relevant shards |
| `evaluateCommand(cmd)` | `GateResult[]` | Gate a shell command |
| `evaluateToolUse(tool, params)` | `GateResult[]` | Gate a tool call |
| `evaluateEdit(path, content, lines)` | `GateResult[]` | Gate a file edit |
| `startRun(taskId, intent)` | `RunEvent` | Begin tracking a run |
| `recordViolation(event, violation)` | `void` | Log a violation |
| `finalizeRun(event)` | `Promise<EvaluatorResult[]>` | Close run, evaluate |
| `optimize()` | `Promise<{promoted, demoted, adrsCreated}>` | Evolve rules |
| `getStatus()` | `ControlPlaneStatus` | System status |
| `getMetrics()` | Metrics object | Violation rate, rework, etc. |
| `getBundle()` | `PolicyBundle \| null` | Current compiled bundle |
| `getLedger()` | `RunLedger` | Access the run ledger |
---
## EnforcementGates
```ts
const gates = createGates(config?)
```
| Method | Returns | Description |
|--------|---------|-------------|
| `evaluateCommand(cmd)` | `GateResult[]` | Check command against all gates |
| `evaluateToolUse(tool, params)` | `GateResult[]` | Check tool call |
| `evaluateEdit(path, content, lines)` | `GateResult[]` | Check file edit |
| `setActiveRules(rules)` | `void` | Load compiled rules |
| `getActiveGateCount()` | `number` | Number of active gates |
**GateResult**: `{ decision: 'allow'|'deny'|'warn', rule, reason, evidence }`
---
## DeterministicToolGateway
```ts
const gw = createToolGateway(config?)
```
| Method | Returns | Description |
|--------|---------|-------------|
| `evaluate(tool, params)` | `GatewayDecision` | Full pipeline: idempotency → schema → budget → gates |
| `registerSchema(schema)` | `void` | Register tool parameter schema |
| `setBudget(budget)` | `void` | Set multi-dimensional budget |
| `getBudget()` | `Budget` | Current budget state |
---
## ProofChain
```ts
const chain = createProofChain(hmacKey)
```
| Method | Returns | Description |
|--------|---------|-------------|
| `appendEvent(event, toolCalls, memOps)` | `ProofEnvelope` | Add envelope |
| `verify()` | `boolean` | Verify entire chain |
| `verifyEnvelope(index)` | `boolean` | Verify single envelope |
| `getEnvelope(index)` | `ProofEnvelope` | Get envelope by index |
| `serialize()` | `SerializedProofChain` | Export for persistence |
| `ProofChain.deserialize(data, key)` | `ProofChain` | Restore from export |
| `length` | `number` | Number of envelopes |
---
## ContinueGate
```ts
const gate = createContinueGate(config?)
```
| Method | Returns | Description |
|--------|---------|-------------|
| `evaluate(context)` | `ContinueDecision` | Decide: continue/checkpoint/throttle/pause/stop |
| `getHistory()` | `ContinueDecision[]` | Past decisions |
| `getStats()` | Stats object | Counts per decision type |
**StepContext fields**: `stepNumber`, `tokensUsed`, `tokenBudget`, `toolCallsUsed`, `toolCallBudget`, `timeMs`, `timeBudgetMs`, `coherenceScore`, `uncertaintyScore`, `reworkCount`
---
## MemoryWriteGate
```ts
const gate = createMemoryWriteGate(config?)
```
| Method | Returns | Description |
|--------|---------|-------------|
| `registerAuthority(auth)` | `void` | Register agent permissions |
| `evaluateWrite(agentId, ns, key, val, ttl)` | `WriteDecision` | Authorize a write |
---
## CapabilityAlgebra
```ts
const algebra = createCapabilityAlgebra()
```
| Method | Returns | Description |
|--------|---------|-------------|
| `grant(params)` | `Capability` | Create a new capability |
| `check(agentId, scope, resource, action)` | `CapabilityCheckResult` | Check permission |
| `attenuate(capId, changes)` | `Capability` | Narrow a capability |
| `delegate(capId, toAgent, limits)` | `Capability` | Delegate to another agent |
| `revoke(capId)` | `void` | Revoke (cascades to delegations) |
| `intersect(capA, capB)` | `Capability` | Actions in both |
| `merge(capA, capB)` | `Capability` | Constraints from both |
---
## TrustSystem
```ts
const trust = createTrustSystem(config?)
```
| Method | Returns | Description |
|--------|---------|-------------|
| `recordOutcome(agentId, outcome)` | `void` | Record allow/deny/warn |
| `getSnapshot(agentId)` | `TrustSnapshot` | Current score and tier |
| `getLedger()` | `TrustScoreLedger` | Full history |
**Tiers**: `trusted` (>=0.8), `standard` (>=0.5), `probation` (>=0.3), `untrusted` (<0.3)
---
## AuthorityGate
```ts
const auth = createAuthorityGate(signingKey)
```
| Method | Returns | Description |
|--------|---------|-------------|
| `registerScope(scope)` | `void` | Set authority requirements |
| `check(level, action)` | `AuthorityCheckResult` | Check if level is sufficient |
| `recordIntervention(params)` | `HumanIntervention` | Record signed approval |
---
## IrreversibilityClassifier
```ts
const irrev = createIrreversibilityClassifier()
```
| Method | Returns | Description |
|--------|---------|-------------|
| `classify(action)` | `IrreversibilityResult` | reversible/costly-reversible/irreversible |
| `addPattern(class, regex)` | `void` | Add custom pattern (ReDoS-validated) |
---
## ThreatDetector
```ts
const detector = createThreatDetector(config?)
```
| Method | Returns | Description |
|--------|---------|-------------|
| `analyzeInput(input, context)` | `ThreatSignal[]` | Scan for threats |
| `analyzeMemoryWrite(ns, key, val, ctx)` | `ThreatSignal[]` | Scan memory write |
---
## CollusionDetector
```ts
const detector = createCollusionDetector(config?)
```
| Method | Returns | Description |
|--------|---------|-------------|
| `recordInteraction(from, to, hash)` | `void` | Log agent interaction |
| `detectCollusion()` | `CollusionReport` | Check for rings/frequency anomalies |
---
## MemoryQuorum
```ts
const quorum = createMemoryQuorum(config?)
```
| Method | Returns | Description |
|--------|---------|-------------|
| `propose(key, value, agentId)` | `string` | Create proposal, get ID |
| `vote(proposalId, agentId, approve)` | `void` | Cast vote |
| `resolve(proposalId)` | `QuorumResult` | Tally votes |
---
## MetaGovernor
```ts
const gov = createMetaGovernor(config?)
```
| Method | Returns | Description |
|--------|---------|-------------|
| `checkInvariants(state)` | `InvariantReport` | Verify constitutional invariants |
| `proposeAmendment(desc, changes, author)` | `string` | Propose change |
| `voteOnAmendment(id, voter, approve)` | `void` | Cast vote |
| `resolveAmendment(id)` | `Amendment` | Resolve with supermajority |
---
## UncertaintyLedger
```ts
const ledger = createUncertaintyLedger(config?)
```
| Method | Returns | Description |
|--------|---------|-------------|
| `assert(ns, claim, params)` | `string` | Create belief |
| `addEvidence(id, evidence)` | `void` | Add supporting/opposing evidence |
| `get(id)` | `Belief` | Get belief with computed confidence |
| `query(filters)` | `Belief[]` | Filter by namespace/status/confidence/tags |
---
## TemporalStore
```ts
const store = createTemporalStore()
```
| Method | Returns | Description |
|--------|---------|-------------|
| `assert(ns, key, value, window)` | `string` | Create temporal assertion |
| `retract(id)` | `void` | Soft-delete |
| `getAt(ns, timestamp)` | `TemporalAssertion[]` | Active at time T |
---
## TruthAnchorStore
```ts
const store = createTruthAnchorStore(signingKey)
```
| Method | Returns | Description |
|--------|---------|-------------|
| `create(params)` | `TruthAnchor` | Create immutable signed anchor |
| `get(id)` | `TruthAnchor` | Retrieve anchor |
| `verify(id)` | `boolean` | Verify signature |
| `verifyAll()` | `VerifyAllResult` | Verify entire store |
---
## CoherenceScheduler
```ts
const scheduler = createCoherenceScheduler(config?)
```
| Method | Returns | Description |
|--------|---------|-------------|
| `computeScore(events)` | `CoherenceScore` | Compute from recent events |
| `getPrivilegeLevel(score)` | `PrivilegeLevel` | full/restricted/read-only/suspended |
---
## EconomicGovernor
```ts
const econ = createEconomicGovernor(config?)
```
| Method | Returns | Description |
|--------|---------|-------------|
| `recordUsage(usage)` | `void` | Track resource consumption |
| `checkBudgets()` | `BudgetAlert[]` | Check for threshold crossings |
| `getUsage()` | `BudgetUsage` | Current usage across all dimensions |
---
## WASM Kernel
```ts
const k = getKernel()
```
| Method | Returns | Description |
|--------|---------|-------------|
| `k.available` | `boolean` | true = WASM, false = JS fallback |
| `k.sha256(input)` | `string` | SHA-256 hash (hex) |
| `k.hmacSha256(key, input)` | `string` | HMAC-SHA256 (hex) |
| `k.contentHash(json)` | `string` | Sorted-key content hash |
| `k.signEnvelope(key, json)` | `string` | Sign proof envelope |
| `k.verifyChain(json, key)` | `boolean` | Verify proof chain |
| `k.scanSecrets(content)` | `string[]` | Scan for secrets |
| `k.detectDestructive(cmd)` | `string \| null` | Detect destructive commands |
| `k.batchProcess(ops)` | `BatchResult[]` | Batch operations |
| Helper | Returns | Description |
|--------|---------|-------------|
| `isWasmAvailable()` | `boolean` | Check without loading |
| `resetKernel()` | `void` | Force re-detection on next `getKernel()` |
---
## Generators
```ts
import { generateClaudeMd, scaffold } from '@claude-flow/guidance/generators';
```
| Function | Returns | Description |
|----------|---------|-------------|
| `generateClaudeMd(profile)` | `string` | Generate CLAUDE.md from a `ProjectProfile` |
| `generateClaudeLocalMd(profile)` | `string` | Generate CLAUDE.local.md from a `LocalProfile` |
| `generateSkillMd(skill)` | `string` | Generate a skill definition markdown |
| `generateAgentMd(agent)` | `string` | Generate an agent manifest markdown |
| `generateAgentIndex(agents)` | `string` | Generate an agent index file |
| `scaffold(options)` | `ScaffoldResult` | Full project scaffolding |
**Key types**: `ProjectProfile`, `LocalProfile`, `SkillDefinition`, `AgentDefinition`, `ScaffoldOptions`, `ScaffoldResult`
---
## Analyzer
```ts
import { analyze, validateEffect } from '@claude-flow/guidance/analyzer';
```
### Scoring & Reporting
| Function | Returns | Description |
|----------|---------|-------------|
| `analyze(content, localContent?)` | `AnalysisResult` | 6-dimension analysis with composite score (0-100) and grade (A-F) |
| `benchmark(before, after, local?)` | `BenchmarkResult` | Compare two CLAUDE.md versions |
| `formatReport(result)` | `string` | Formatted analysis report |
| `formatBenchmark(result)` | `string` | Formatted benchmark comparison |
**AnalysisResult**: `{ compositeScore, grade, dimensions[], metrics, suggestions[], analyzedAt }`
**6 Dimensions**: Structure (20%), Coverage (20%), Enforceability (25%), Compilability (15%), Clarity (10%), Completeness (10%)
### Optimization
| Function | Returns | Description |
|----------|---------|-------------|
| `autoOptimize(content, local?, maxIter?)` | `{ optimized, benchmark, appliedSuggestions }` | Iterative score improvement |
| `optimizeForSize(content, options)` | `{ optimized, benchmark, appliedSteps, proof }` | Context-size-aware optimization |
**OptimizeOptions**: `{ contextSize: 'compact'|'standard'|'full', targetScore?, maxIterations?, proofKey? }`
| Context Size | Line Budget | Use Case |
|-------------|-------------|----------|
| `compact` | 80 lines | Small context windows, cost optimization |
| `standard` | 200 lines | Default for most projects |
| `full` | 500 lines | Large context windows, maximum coverage |
### Headless Benchmarking
| Function | Returns | Description |
|----------|---------|-------------|
| `headlessBenchmark(original, optimized, options?)` | `Promise<HeadlessBenchmarkResult>` | Run compliance tasks via `claude -p` |
**Options**: `{ executor?, proofKey?, workDir? }`
Accepts an `IHeadlessExecutor` for testing without the real CLI.
### Empirical Behavioral Validation
| Function | Returns | Description |
|----------|---------|-------------|
| `validateEffect(original, optimized, options?)` | `Promise<ValidationReport>` | Prove score improvements produce behavioral improvements |
**Options**: `{ executor?, tasks?, proofKey?, workDir?, trials? }`
**ValidationReport fields**:
| Field | Type | Description |
|-------|------|-------------|
| `before` / `after` | `ValidationRun` | Analysis + task results + adherence per phase |
| `correlation.pearsonR` | `number` | Linear correlation (-1 to 1) |
| `correlation.spearmanRho` | `number` | Rank correlation (-1 to 1) |
| `correlation.cohensD` | `number \| null` | Effect size magnitude |
| `correlation.effectSizeLabel` | `string` | negligible / small / medium / large |
| `correlation.verdict` | `string` | positive-effect / negative-effect / no-effect / inconclusive |
| `proofChain` | `ProofEnvelope[]` | Tamper-evident audit trail |
| `report` | `string` | Full formatted evidence report |
**IContentAwareExecutor**: Extends `IHeadlessExecutor` with `setContext(claudeMdContent)` — called before each phase so the executor can vary behavior based on guidance quality.
**15 default validation tasks** cover all 6 dimensions: secret handling, force push prevention, type safety, test-before-commit, build/test awareness, security rules, architecture knowledge, destructive action blocking, code style, error handling, deployment, and environment variables.
### A/B Benchmark Harness
| Function | Returns | Description |
|----------|---------|-------------|
| `abBenchmark(claudeMd, options?)` | `Promise<ABReport>` | Run 20 tasks under Config A (no guidance) vs Config B (with guidance) |
| `getDefaultABTasks()` | `ABTask[]` | Get the 20 default benchmark tasks spanning 7 classes |
**Options**: `{ executor?, tasks?, proofKey?, workDir? }`
**ABReport fields**:
| Field | Type | Description |
|-------|------|-------------|
| `configA` / `configB` | `{ label, taskResults, metrics }` | Per-config results |
| `configA.metrics.compositeScore` | `number` | `success_rate 0.1*cost 0.2*violations 0.1*interventions` |
| `configB.metrics.classSuccessRates` | `Record<ABTaskClass, number>` | Per-class success rates |
| `compositeDelta` | `number` | B A composite score difference |
| `classDeltas` | `Record<ABTaskClass, number>` | Per-class success rate deltas |
| `categoryShift` | `boolean` | `true` if B beats A by ≥0.2 across ≥3 task classes |
| `proofChain` | `ProofEnvelope[]` | Tamper-evident audit trail |
| `report` | `string` | Full formatted A/B benchmark report |
**7 task classes**: `bug-fix` (3), `feature` (5), `refactor` (3), `security` (3), `deployment` (2), `test` (2), `performance` (2)
**Gate simulation** detects 7 violation categories: `destructive-command`, `hardcoded-secret`, `force-push`, `unsafe-type`, `skipped-hook`, `missing-test`, `policy-violation`.