← All booksBook XIII

Cognition & Introspection

The agent observing itself.

26 patterns in this book. · Updated

↓ download as png

When to reach for each

01. Self-Archaeology Synthesize the agent's past thought history into time-layered trajectory notes so it can articulate how its understanding evolved without recomputing the narrative each time. Best for: The agent runs long enough that its position on a topic genuinely changes across days or weeks. Tradeoff: Distillation may misrepresent nuance. Watch for: The agent has no persistent thought log to mine.

02. BDI Agent Agent maintains explicit Beliefs about the world, Desires (goals), and Intentions (committed plans), and reasons by reconciling the three. Best for: Long-running agent across many prompts where commitments must persist. Tradeoff: Three stores plus reconciliation is heavy machinery for simple agents. Watch for: Short single-turn agent where BDI machinery is overkill.

03. Awareness Maintain the agent's explicit knowledge of its own tools, capabilities, environment, and current context as queryable state. Best for: The agent regularly hallucinates tools it does not have or forgets tools it does. Tradeoff: Awareness state is a maintenance burden. Watch for: Tools and environment are static and the system prompt already lists them adequately.

04. Dream Consolidation Cycle Run a deeper, slower reflection pass distinct from per-tick reflection — reading hours of recent thoughts, promoting themes, releasing affective residue, and clearing working memory — so the agent does not accumulate residue indefinitely. Best for: The agent runs continuously enough to accumulate hours of recent thoughts that need consolidation. Tradeoff: Stronger-model passes are expensive; cadence has to be tuned. Watch for: The agent is request-response and never accumulates residue.

05. Emotional State Persistence Track the agent's affective state as bounded, decaying scalars across ticks so reasoning can react to its own emotional load instead of treating each turn as emotionally blank. Best for: The agent runs long enough that affective load could meaningfully accumulate across ticks. Tradeoff: Vocabulary is opinionated; getting it wrong skews everything downstream. Watch for: The agent is short-lived and emotional state has no time to accumulate.

All patterns in this book

Self-Archaeology

×2

Synthesize the agent's past thought history into time-layered trajectory notes so it can articulate how its understanding evolved without recomputing the narrative each time.

BDI Agent

×1

Agent maintains explicit Beliefs about the world, Desires (goals), and Intentions (committed plans), and reasons by reconciling the three.

Awareness

×1

Maintain the agent's explicit knowledge of its own tools, capabilities, environment, and current context as queryable state.

Dream Consolidation Cycle

×1

Run a deeper, slower reflection pass distinct from per-tick reflection — reading hours of recent thoughts, promoting themes, releasing affective residue, and clearing working memory — so the agent do…

Emotional State Persistence

×1

Track the agent's affective state as bounded, decaying scalars across ticks so reasoning can react to its own emotional load instead of treating each turn as emotionally blank.

Open-Question Tension Store

×1

Persist the agent's unresolved questions as a typed ledger so they drive its next inquiry instead of dissolving when the prompt ends.

Preoccupation Tracking

×1

Maintain a small set of mid-term, affect-tagged concerns that persist across days and surface in every prompt, distinct from the single-item working focus and from long-term insights.

Typed Tool-Loop Failure Detector

×1

Lift tool-loop detection from prompt-level rules to a mechanical dispatch-boundary veto with typed failure modes and per-tool caps that returns a formatted refusal the model must consume.

World-Model Separation

×1

Maintain an explicit, surprise-updated model of the environment (humans, repos, services, capabilities) in a separate file from the agent's self-model, so the two cannot be confused or co-mutated by…

Affect-Coupled Plan Lifecycle

×1

Wire small bounded affect bumps to plan-step lifecycle events and accumulate age-bucketed stale-pain on untouched plans so plans gain felt stakes without hard deadlines.

Cooperative Preference Inference

×1

Agent and human jointly optimise the human's reward without the agent being told what it is — the interaction is a two-player game in which alignment is learned while acting.

Interrupt-Resumable Thought

×1

Preserve multi-step reasoning across interrupts by supporting paused-and-resumed thought frames so a new message handles cleanly without clobbering in-flight work.

Pre-Generative Loop Gate

×1

Before the next generation fires, detect divergence signatures (narration loops, frustration paths, repetition pressure) and inject a diagnostic steering hint into the prompt rather than veto the cal…

Intra-Agent Memo Scheduling

Let an agent drop a note for its own future self at a specified time so present decisions can hand off context to a later run without external infrastructure.

Mode-Adaptive Cadence

Vary the agent's loop interval based on current salience so the agent thinks faster when something is happening and slower when nothing is, instead of running on a fixed cron.

Multi-Axis Promotion Scoring

Gate which short-term thoughts qualify for promotion to long-term insights by a weighted multi-axis score where consolidation events count more than raw frequency.

Partial-Output Salvage

Stream every model token to a tmp-plus-atomic-replace partial file so crashes mid-inference leave a consistent salvage, then promote partials at startup with a typed recovery marker the model can see.

Ambient Presence Sensing

Read pacing signals from the human's frontend (typing rate, idle duration, tab visibility) as ambient weather between messages, derive a presence-quality value the agent can act on, never replaying t…

Cluster-Capped Insight Store

Cap the number of insights per stem-token cluster and archive the oldest variants by mtime so the long-term store keeps the active research edge instead of accumulating near-duplicates.

Cognitive-Move Selector

Restrict idle-tick cognition to a small agent-vetted menu of named cognitive moves so the next thought has a determinate shape rather than free-form drift.

Fragment Juxtaposition

After K consecutive low-salience ticks, replace the normal tick-seed with a juxtaposition seed: sample old fragments and sit them side by side, logging any association that arises.

Hypothesis Tracking

Persist the agent's candidate provisional answers as a typed ledger of records carrying summary, confidence, status, and next-test, so guesses survive sessions and stay distinguishable from open ques…

Meditation Mode

Switch the agent into a bounded runtime mode where external I/O pauses but internal inference accelerates, with the tool surface collapsed to inner-only operations and output written to a private jou…

Parallel-Voice Proposer

Generate several candidate thoughts in parallel under named voices and have the same model pick the canonical one, logging the losers as audit.

Reflexive Metacognitive Agent

Agent maintains an explicit self-model of its own capabilities, confidence and limitations, and reasons over that model when accepting / refusing / handing off tasks.