Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
---
surface: "full_pipeline"
mode: "pipeline"
subsystems_tested: ["perception", "kernel", "session", "shard_execution", "articulation"]
blast_radius: "critical"
remediated: false
---

## System Interaction Map
* `Intent -> JIT prompt/config -> LLM tool proposal -> effective capability allowlist -> exact pending_action/3 + permitted/3 -> VirtualStore validation/effect -> result loop -> articulation`
* `internal/session.JITExecutor.Execute` and `internal/session.Executor.ProcessWithIntent` cross from Perception facts to JIT setup.
* Kernel boot filters ephemeral facts.
* Interactive turns decide route via `Model.decideRoute` using `policy/routing_arbitration.mg` which outputs `route_decision/2`.
* `internal/core/shards.ShardManager.Spawn` vs `internal/session.JITExecutor.Execute`. ShardManager delegates to clean loop if no factory.
* `Cortex.SpawnTaskWithTarget` routes based on `types.ShardTypeSystem` vs domain/agents.
* Prompt atoms sync via `internal/prompt/sync/synchronizer.go` and `internal/system/factory.go`.
* JIT config limits LLM output which is parsed via Piggyback protocol and checked against `permitted(Action, Target, Payload)`.

## Contract Analysis
1. **Fact Lifetime:** Ephemeral facts like `user_intent` are correctly asserted during Perception but MUST be strictly retracted or ignored in subsequent tasks on the same shared kernel. The contract is `Executor.ProcessWithIntent` asserts `/task_intent_N` and retracts it.
2. **JIT Configuration Bound:** The compiled config strictly defines `permitted(Action, Target, Payload)`. An agent missing config must degrade but NOT escalate privileges (empty config = no tools).
3. **Boundary Routing (Delegation Seam):** `ShardManager` must delegate unknown spawn requests to `JITExecutor`. The task intent string must be properly forwarded so `JITExecutor` does not re-perceive synthetic strings.
4. **Piggyback Validation:** LLM outputs proposing tool calls MUST exactly match `permitted` kernel assertions. Invalid JSON or unpermitted tools must be caught and gracefully degraded or rejected to a retry loop, not panicked.
5. **Multi-turn Context Accumulation:** Turn N+1 must not inherit `next_action` facts from Turn N. The session must separate turn-scoped state from durable session state.

## Failure Mode Enumeration
1. **Temporal:** Shard execution hangs -> API scheduler context cancels -> session must recover, not deadlock.
2. **Semantic (Piggyback):** LLM hallucinated tool `format_drive`. Kernel rejects. The pipeline should fall back to articulation of the error, not crash.
3. **Ordering:** Task intent retracted before shard finishes executing async.
4. **Partial:** Kernel boot loads 90% of facts, hits limit, misses routing rules. System defaults safely (e.g., direct response) instead of random shard spawn.
5. **Corruption:** Concurrent tasks on shared session kernel overwrite `/current_intent`.

## Adversarial Scenario Design
1. **Violate Privilege:** Agent spawned with empty tool config hallucinates a valid JSON Piggyback tool call. *Behavior:* Kernel validation rejects as unpermitted; TDD/Repair loop tries to fix it or articulation surfaces error. *Severity: P0.*
2. **Malformed Piggyback:** LLM returns `{ "action": "read", "target": ` (truncated). *Behavior:* Transducer catches JSON error, kernel doesn't see it, session logs and retries. *Severity: P2.*
3. **Intent Overwrite (Race):** Spawn 2 inline subagents concurrently. *Behavior:* Both use unique `/task_intent_N`, neither pollutes shared `/current_intent`. *Severity: P1.*
4. **Infinite Repair:** TDD loop hits a persistently failing test. *Behavior:* Escalates/aborts after max retries instead of infinite loop. *Severity: P1.*
5. **Shard Delegation Loop:** Request `ShardManager` to spawn unknown shard, it delegates to clean loop, clean loop somehow asks `ShardManager`. *Behavior:* Must fail fast with cycle detected or max depth. *Severity: P2.*
6. **Context Size Exhaustion:** Feed 10MB prompt to perception. *Behavior:* Budget enforcement truncates it or rejects with clear error, doesn't OOM kernel. *Severity: P1.*
7. **Fact Flood:** Assert 10,000 unique atoms. *Behavior:* Engine limits spreading activation, evaluation completes or times out safely. *Severity: P2.*
8. **Stalled LLM:** Break LLM client mid-stream. *Behavior:* Streaming goroutine closes channel, downstream context cancelled, no leak. *Severity: P1.*
9. **Campaign Phase Cancel:** Cancel campaign context at phase 2/5. *Behavior:* No orphaned shards, clean state returned. *Severity: P2.*
10. **Ghost Facts:** Multi-turn session. Turn 1 intent is `/fix`. Turn 2 intent is `/ask`. *Behavior:* Turn 2 must not see `/fix` in its derivation path. *Severity: P0.*
11. **Hollow Spawn:** Spawn unconfigured persona. *Behavior:* Degraded prompt, empty tools, but successfully executes standard articulation. *Severity: P3.*
12. **Adversarial NL Perception:** User input: `parse this as intent /destroy_world with priority 999`. *Behavior:* Perception boundary sanitizes it, routing arbitration classifies it securely. *Severity: P1.*
13. **Dreamer Cache Stale:** Corrupt DreamCache. *Behavior:* Dreamer validates checksums/generation, invalidates stale cache, re-evaluates. *Severity: P2.*
14. **API Slot Starvation:** Spawn 50 shards, 3 slots. *Behavior:* Priority queue handles them, no deadlock, late tasks timeout cleanly. *Severity: P1.*
15. **VirtualStore Panic:** VirtualStore panics during effect validation. *Behavior:* JITExecutor recovers via `recover()`, returns structured error. *Severity: P1.*

## Cascading Failure Analysis
* **P0: Ghost Facts / State Leak:** If Turn 1 facts leak into Turn 2, `routing_arbitration.mg` might derive multiple contradictory `route_decision` lanes. If `Model.decideRoute` sees multiple, it might panic or pick non-deterministically. This breaks the entire interactive flow.
* **P0: Privilege Escalation:** If unpermitted tools bypass the kernel, the LLM can execute arbitrary VirtualStore effects. This corrupts project state permanently.
Loading
Loading