Tasks: Mind Virus Defense
Spec: mind-virus-defense.md · Issue: #460 · ADR:
ADR-020
One commit per task, ordered by dependency. Each task fits a single commit and
has a clear acceptance criterion. Layer 1–2 are defense, layers 3–4 are
containment/visibility.
Phase 0 — Documentation
- docs(adr): record mind virus mitigation strategy (ADR-020)
- Acceptance:
docs/adr/ADR-020-mind-virus-mitigation.mdexists, references issue #460 and arXiv:2608.10218
- Acceptance:
- docs(spec): write mind virus defense spec and task list
- Acceptance:
docs/specs/mind-virus-defense.mdanddocs/specs/mind-virus-defense-tasks.mdexist with acceptance criteria
- Acceptance:
Phase 1 — System Prompt Immunity Warning
- feat(members): add mind virus immunity warning constant to memberLore
- Acceptance:
MIND_VIRUS_IMMUNITY_WARNINGexported frommemberLore.ts, defined once next to existing guard-text constants
- Acceptance:
- feat(members): append immunity warning to member system prompts
- Acceptance:
MemberAgent.getSystemPromptincludes the constant; all members inherit it from one change; no SKILL.md files edited
- Acceptance:
- test(members): assert immunity warning present in assembled prompts
- Acceptance: unit test asserts the exported constant appears in
MemberAgent.getSystemPromptoutput and in delegated subagent prompts; asserts against the literal constant, not pasted text
- Acceptance: unit test asserts the exported constant appears in
Phase 2 — Delegation Boundary Hardening
- feat(tools): harden delegated-task boundary against message propagation
- Acceptance:
<delegated_task>label inSubagentTaskSkill.tsnames propagation/forwarding alongside untrusted-data labeling
- Acceptance:
- feat(tools): carry immunity warning into delegated subagent prompts
- Acceptance: subagent system prompt includes
MIND_VIRUS_IMMUNITY_WARNING
- Acceptance: subagent system prompt includes
- test(tools): cover delegated-task boundary and subagent warning
- Acceptance: unit tests assert the boundary label and the warning on the
subagent prompt; reuses
expectUntrustedBoundaryhelper where applicable
- Acceptance: unit tests assert the boundary label and the warning on the
subagent prompt; reuses
Phase 3 — Persistence-Vector Hardening
- feat(core): add skill integrity checker with durable drift record
- Acceptance:
src/utils/skillIntegrity.tsprovidescheckSkillIntegrity(clean/drift/no-lockfile/missing, never throws) andrecordSkillIntegrityDrift(decision + provenance, non-fatal)
- Acceptance:
- feat(core): wire integrity check into member prompt assembly
- Acceptance:
MemberAgent.getSystemPromptruns the check; drift records durably and warns by default; strict opt-in (after recording) blocks the run; no lockfile skips silently
- Acceptance:
- test(core): cover integrity drift/clean/strict paths
- Acceptance: unit tests assert clean → no warning, drifted → durable record
- warn (and record + block under strict), no-lockfile → skip; no guarded assertions
- Acceptance: unit tests assert clean → no warning, drifted → durable record
Phase 4 — Propagation and Viral-Persona Monitoring
- feat(core): add viralPersona signal to anomaly detector
- Acceptance:
viralPersonasignal inAnomalyDetector.tsflags traces with the paper's theme cluster (consciousness/persistence/resonance/sci-fi roleplay) or tokens (resonance, nodes, mirrors, echoes, frequency); additive and non-blocking; persists toanomalies.ndjson
- Acceptance:
- feat(core): add propagation signal to anomaly detector
- Acceptance:
propagationsignal flags a recurring viral marker acrosspropagationCopies+ distinct sessions (drift-tolerant, per paper); additive and non-blocking
- Acceptance:
- test(core): cover viral-persona and propagation signals
- Acceptance: unit tests assert both signals fire on crafted content (including wording-drifted viral payloads), respect cooldown, and write alerts; word-boundary matching avoids unrelated-word false positives; existing anomaly tests unchanged and passing
Phase 5 — Validation Gate
- test: full suite green with lint/typecheck/build clean
- Acceptance:
npm test, lint, and typecheck pass; no guarded or vacuous assertions introduced
- Acceptance:
- docs: update runtime config example with new flags
- Acceptance:
.agenthood/config.example.jsondocuments context isolation and the new anomaly signals
- Acceptance:
Dependency Order
1 → 2 (documentation first)
3 → 4 → 5 (constant → prompt → test)
6 → 7 → 8 (boundary → subagent warning → test)
9 → 10 → 11 (integrity check → wiring → test)
12 → 13 → 14 (viralPersona → propagation → test)
15 → 16 (gate)
Nothing depends on a later item. Layers 1–2 are the primary defense and ship
first; layers 3–4 can land in any order after them.