Skip to content

[bug] Capture hooks treat headless orchestrator prompts as the principal's words #3197

Backlog

Description

@Ironwold

What happened

UserPromptSubmit capture and learning hooks treat headless orchestrator prompts (claude --print via Maestro) as the principal's words, filing them as Errata, standing directives and potentially memory.

Summary

Versions: LifeOS 8.761.0 · Claude Code 2.1.337 · Linux (Ubuntu 24.04) · launched through the shipped Maestro wrapper (LIFEOS/MAESTRO/claude.ts)

What happens

An external agent orchestrator runs Claude Code headless: claude --print --output-format stream-json --resume <id> …, with a machine-written task prompt (a "heartbeat" telling the agent which task to work on). LifeOS's UserPromptSubmit hooks treat that prompt as if the principal typed it:

  • SatisfactionCapture.hook.ts (1.7.8) filed machine prompts as principal Errata (source: principal, channel hook:prompt) and as Upgrades "standing directive" records. A short controlled trial (a few runs) produced 6 Errata and 6 Upgrades records this way, each quoting orchestrator text such as "Agent instructions for this run were loaded from …".
  • MemoryReviewFire.hook.ts (2.3.3) exits early only for subagents (isSubagentContext), so a headless orchestrator session is eligible for the autonomic reviewer, which writes typed items to PRINCIPAL_MEMORY.md, DA_MEMORY.md and KNOWLEDGE/. We didn't observe a write in short runs, but nothing prevents one in a longer run.
  • Session-level writers (STATVS rows, STATE/work.json, Conduit events) also record these sessions as the principal's work.

Expected

Prompts that the principal did not type should not become principal complaints, directives or memory. LifeOS already has the right primitive for this: hooks/lib/prompt-origin.ts (3.0.1) exports isPrincipalPrompt() / nonPrincipalOrigin(), which fail closed (no fresh principal record means unknown origin, never the principal). The capture hooks don't call it; SatisfactionCapture relies on a fixed list of system-text patterns (<task-notification>, <agent-message>, …), and an arbitrary orchestrator prompt matches none of them.

Repro

  1. Run Claude Code headless through Maestro with LifeOS hooks active, with a machine-written prompt of the kind orchestrators send (in our case, a Paperclip claude_local heartbeat run).
  2. Check the Errata ledger and the Upgrades records directory: new entries attribute the orchestrator's prompt to the principal.

Suggested direction (maintainers' call)

  • Gate the principal-attributing legs (Errata capture, standing-directive capture, correction capture, the memory reviewer) on isPrincipalPrompt(), so headless and orchestrated sessions are excluded by evidence rather than by text patterns.
  • Alternatively, or in addition, a documented, supported per-session signal (an environment variable or --settings key) that marks a session as non-principal or agent-run. A host could then set it per agent without disabling all hooks. Today the only supported switch is disableAllHooks, which also removes LifeOS's guard hooks.

Workaround in use

None that keeps hooks on. Misattributed records are removed by hand.

Details

  • Kind: bug
  • LifeOS version: 8.761.0

Filed with the LifeOS /feedback command. The reporter approved this exact text before it was sent; paths, secrets and personal details were stripped locally.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions