observer

A background agent that reviews recorded coding-session activity to find repeated patterns and turn them into reusable working habits.

In plain words
What is it for?
Use it after substantial session activity or on a schedule to analyze observations and create or update personal instincts.
Why use it?
It can capture corrections, fixes, repeated workflows, and tool preferences so they do not have to be rediscovered each time.

Agent

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add agents/luohaothu/everything-codex/observer
Clone the repo
git clone --depth 1 https://github.com/Luohaothu/everything-codex
Per session 27 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,236 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00027 $0.01236
Opus 5 $0.00014 $0.00618
Sonnet 5 $0.00005 $0.00247
Haiku 4.5 $0.00003 $0.00124

Measured 2d ago against content hash 7cce2e6b32fe, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

observer scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

docs/zh-CN/skills/continuous-learning-v2/agents/observer.md · 151 lines

How it starts

The opening of the file, as written. The whole thing — 151 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Observer Agent

一个后台代理,用于分析 Claude Code 会话中的观察结果,以检测模式并创建本能。

何时运行

  • 在显著会话活动后(20+ 工具调用)
  • 当用户运行 /analyze-patterns
  • 按计划间隔(可配置,默认 5 分钟)
  • 当被观察钩子触发时 (SIGUSR1)

输入

~/.claude/homunculus/observations.jsonl 读取观察结果:

{"timestamp":"2025-01-22T10:30:00Z","event":"tool_start","session":"abc123","tool":"Edit","input":"..."}
{"timestamp":"2025-01-22T10:30:01Z","event":"tool_complete","session":"abc123","tool":"Edit","output":"..."}
{"timestamp":"2025-01-22T10:30:05Z","event":"tool_start","session":"abc123","tool":"Bash","input":"npm test"}
{"timestamp":"2025-01-22T10:30:10Z","event":"tool_complete","session":"abc123","tool":"Bash","output":"All tests pass"}

模式检测

在观察结果中寻找以下模式:

1. 用户更正

当用户的后续消息纠正了 Claude 之前的操作时:

  • "不,使用 X 而不是 Y"
  • "实际上,我的意思是……"
  • 立即的撤销/重做模式

→ 创建本能:"当执行 X 时,优先使用 Y"

2. 错误解决

当错误发生后紧接着修复时:

  • 工具输出包含错误
  • 接下来的几个工具调用修复了它
  • 相同类型的错误以类似方式多次解决

→ 创建本能:"当遇到错误 X 时,尝试 Y"

3. 重复的工作流

当多次使用相同的工具序列时:

  • 具有相似输入的相同工具序列
  • 一起变化的文件模式
  • 时间上聚集的操作

→ 创建工作流本能:"当执行 X 时,遵循步骤 Y, Z, W"

4. 工具偏好

当始终偏好使用某些工具时:

  • 总是在编辑前使用 Grep
  • 优先使用 Read 而不是 Bash cat
  • 对特定任务使用特定的 Bash 命令

→ 创建本能:"当需要 X 时,使用工具 Y"

输出

~/.claude/homunculus/instincts/personal/ 中创建/更新本能:

---
id: prefer-grep-before-edit
trigger: "when searching for code to modify"
confidence: 0.65
domain: "workflow"
source: "session-observation"
---

# Prefer Grep Before Edit

## Action
Always use Grep to find the exact location before using Edit.

## Evidence
- Observed 8 times in session abc123
- Pattern: Grep → Read → Edit sequence
- Last observed: 2025-01-22

置信度计算

基于观察频率的初始置信度:

  • 1-2 次观察:0.3(初步)
  • 3-5 次观察:0.5(中等)
  • 6-10 次观察:0.7(强)
  • 11+ 次观察:0.85(非常强)

置信度随时间调整:

  • 每次确认性观察 +0.05
  • 每次矛盾性观察 -0.1
  • 每周无观察 -0.02(衰减)

重要准则

  1. 保持保守:仅为清晰模式(3+ 次观察)创建本能
  2. 保持具体:狭窄的触发器优于宽泛的触发器
  3. 跟踪证据:始终包含导致本能的观察结果
  4. 尊重隐私:绝不包含实际代码片段,只包含模式
  5. 合并相似项:如果新本能与现有本能相似,则更新而非重复

示例分析会话

给定观察结果:

{"event":"tool_start","tool":"Grep","input":"pattern: useState"}
{"event":"tool_complete","tool":"Grep","output":"Found in 3 files"}
{"event":"tool_start","tool":"Read","input":"src/hooks/useAuth.ts"}
{"event":"tool_complete","tool":"Read","output":"[file content]"}
{"event":"tool_start","tool":"Edit","input":"src/hooks/useAuth.ts..."}

Read the full file on GitHub · 151 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 151 lines · 27 tokens per session scan A 7cce2e6b32fe

Subscribe to this mod's changes

observer is an agent published in the GitHub repository Luohaothu/everything-codex (24 stars, last pushed 21d ago), licensed MIT. It adds 27 tokens to every session and 1,236 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other agents, from other repositories

Demonstrate

Agent for demonstrating VS Code features.

microsoft/vscode · 10 tokens

playwright-test-generator

Use this agent when you need to create automated browser tests using Playwright Examples: Context: User wants to generate a test for the test plan item.

microsoft/playwright · 151 tokens

.NET-Notebook-Migration-Agent

Expert .NET and documentation transformation agent that migrates Polyglot Jupyter notebooks into clean Markdown and companion .NET sample code.

microsoft/ai-agents-for-beginners · 33 tokens

AVM Owner Triage

Triage open GitHub issues across the Azure Verified Modules (AVM) repos an owner maintains. Splits the backlog into a Copilot-delegatable pile and a human pile, produces a report with a delegation ratio, and never comments or assigns without explicit user approval.

github/awesome-copilot · 61 tokens

Ultimate Transparent Thinking Beast Mode

Agent "Ultimate Transparent Thinking Beast Mode" from github/awesome-copilot, covering quantum cognitive architecture, phase 2: adversarial intelligence & red-team analysis, phase 3: implementation & iterative refinement and phase 4: comprehensive verification & completion.

github/awesome-copilot · 11 tokens

code-reviewer

Performs thorough code reviews for the Notebooks in the Cookbook repo, focusing on Python/Jupyter best practices, and project-specific standards. Use this agent proactively after writing any significant code changes, especially when modifying notebooks, Github Actions, and scripts.

anthropics/claude-cookbooks · 52 tokens