The attention layer for LLM agents — see what the model fires before it ships.
Project description
StateProbe
The attention layer for LLM agents.
Your agent already drifted — wrong focus, stale context, confidently editing files you never asked about. StateProbe catches it before the agent ships the answer. Works with Claude Code, Cursor, Cline, Continue, and any MCP host.
For closed-source agents, this is fast task-level attention inferred from text. Open-weight models unlock the optional Lab / future Runtime Probe path for activations and vectors.
English | 简体中文
Why
LLM agents drift. They miss the user's actual point, get steered by stale context, or burn cycles on the wrong subtopic. Today's fix is "rewrite the prompt and pray." StateProbe gives you a sharper tool:
- See what the agent is about to focus on, before it answers
- Decide to continue, rewrite the focus, ask a boundary question, or cut stale context
- Audit the actual output afterwards and surface drift
Runs locally. Costs zero LLM tokens by default. Plugs into any MCP host.
Install
pip install stateprobe
For MCP integration (Claude Code, Cursor, Cline, Continue):
pip install "stateprobe[mcp]"
For activation projection on open-source DeepSeek (optional):
pip install "stateprobe[lab]"
30-second demo
Copy-paste this after pip install stateprobe to catch a bad plan before it ships:
stateprobe skill preview \
--context-text "Focus on safety; do not include deprecated APIs." \
--plan-text "I will list deprecated APIs and explain why they are unsafe."
After the agent answers, audit alignment with user requirements:
stateprobe skill overlay \
--context-text "Focus on safety; do not include deprecated APIs." \
--output-text "The answer recommends a deprecated API first."
Or run the legacy prompt diagnostic, with the included
smart_but_not_answering demo:
stateprobe demo
What it gives back
stateprobe skill preview returns a JSON activation_decision — your agent host branches on it:
| Action | Meaning |
|---|---|
continue |
Aligned. Agent can speak. |
rewrite_planned_focus |
Plan misses user's actual must. Don't ship. Rewrite focus first. |
ask_boundary_question |
Visual / creative ambiguity. Ask the user one yes/no first. |
cut_context_contamination |
Agent is following stale context. Cut the old direction first. |
stateprobe skill overlay returns an interrupt_level (ok / watch / interrupt) plus attention_gaps and control_levers for the next turn.
Full schemas: Skill spec, MCP server.
Two product lines
| Line | What | Status |
|---|---|---|
| Skill — Agent Attention HUD | Shipped external control layer. Text-to-text task attention, preview before output, overlay after output, control levers for the next turn. Works with closed and open models. | ✅ Shipped |
| Lab — Activation Projection | Opt-in open-weight lab path. Projects prompt activations onto Persona Vectors on DeepSeek-R1-Distill-Qwen. Requires local model access. | ✅ Available / experimental |
| Enterprise — Runtime Probe | Future production line for hidden states, router traces, expert routing, output-state reports, and operator controls on open-weight models. | 🛠 Placeholder only |
Boundary: the Skill HUD never claims neural interpretability; it makes task-level attention visible and steerable from text. Closed-source APIs (OpenAI, Claude) cannot expose hidden states — OpenAI/Claude 物理上读不到 hidden states — so they run the Skill layer only. Open-source models (DeepSeek, Qwen, Llama) unlock the Lab path today and the future Runtime Probe line later.
How it differs
| promptfoo | Guardrails AI | LangSmith | StateProbe | |
|---|---|---|---|---|
| Analyzes | Output quality | Output safety | Call traces | Agent's planned attention before output |
| When | After release | Runtime | Production | Before each turn |
| LLM API needed | Yes | Yes | Yes | No (default) |
Complementary, not competitive. promptfoo / Guardrails check what came out; StateProbe shapes what's about to come out.
Architecture
Hybrid evidence pipeline (ADR_009): independent contributors emit confidence-weighted evidence, aggregated into 8 behavior axes. Static rules are always on (zero cost); the LLM and Lab layers are opt-in and stack on top.
| Layer | Purpose | Cost |
|---|---|---|
Static Mode (StaticRuleContributor) |
Regex rules. Always on. | Zero |
LLM judge (LLMJudgeContributor) |
LLM semantic evidence. Opt-in via --llm-augment. |
API call |
DeepSeek Lab (LabContributor) |
Hidden-state projection on DeepSeek-R1-Distill-Qwen-1.5B. Opt-in via --lab-augment. |
Local GPU |
| Black-box Eval (independent) | Runs original / rewritten prompts on a target model and scores outputs. | API call |
Theoretical foundation:
- Anthropic — Persona Vectors: Monitoring and Controlling Character Traits in Language Models
- DeepSeek-AI — DeepSeek-R1: Incentivizing Reasoning Capability in LLMs via Reinforcement Learning
DeepSeek-first, not DeepSeek-only — see DeepSeek roadmap.
Roadmap
- v0.3 (current) — Skill HUD, MCP server, Lab activation projection on 4 axes
- v0.3.1 — Remaining 4 axes; embedding contributor for offline fallback; VS Code / Cursor extension
- v0.4 — MoE expert routing contributor on DeepSeek-MoE
- v0.5 — Named steering vectors; output-time intervention API
See CHANGELOG for the full version history.
Documentation
- Skill spec — attention HUD reference
- MCP server — Claude Code / Cursor / Cline / Continue setup
- Architecture — hybrid evidence pipeline
- FAQ — common objections answered
More docs — evidence model, ADRs, roadmaps, contributor guides
- Evidence model — three-layer evidence boundaries
- DeepSeek roadmap — DeepSeek-first, not DeepSeek-only
- Architecture decisions — ADRs for hybrid pipeline and lab contributor
- Publishing — release process
- CHANGELOG / CITATION / CODE_OF_CONDUCT / CONTRIBUTING
中文文档(含 China 镜像、PowerShell 编码 fix、完整命令样例):README.zh-CN.md
Contributing
Rule library quality = the project's core value. If you find a prompt pattern that isn't detected, a misfire, or want a new target preset — open an issue or PR.
Each rule contribution must include: pattern / affected axis / direction / weight / mechanism / paper citation. See CONTRIBUTING.md.
python scripts/acceptance_check.py
License
MIT — see LICENSE.
Built on Anthropic interpretability and DeepSeek-AI open research. This tool turns those findings into something agent hosts and prompt engineers can use every day, without having to actually answer the question of how the model "thinks" — just what it's about to focus on next.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file stateprobe-0.3.1.tar.gz.
File metadata
- Download URL: stateprobe-0.3.1.tar.gz
- Upload date:
- Size: 124.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
765ef8140a8df4d8a07c42756129cb5105f1e7d03b9fde46470b2c4bcd94e2a0
|
|
| MD5 |
7e598210dd1e3572920f67f8f0698764
|
|
| BLAKE2b-256 |
96d5b578e0c4ab43fac1e127561f951298d14b2870b4dfddb97658ce23a782c6
|
Provenance
The following attestation bundles were made for stateprobe-0.3.1.tar.gz:
Publisher:
publish.yml on Erye932/stateprobe
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
stateprobe-0.3.1.tar.gz -
Subject digest:
765ef8140a8df4d8a07c42756129cb5105f1e7d03b9fde46470b2c4bcd94e2a0 - Sigstore transparency entry: 1615291114
- Sigstore integration time:
-
Permalink:
Erye932/stateprobe@b7216377f1295902ec655b884019b8fec8bd66ea -
Branch / Tag:
refs/tags/v0.3.1 - Owner: https://github.com/Erye932
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@b7216377f1295902ec655b884019b8fec8bd66ea -
Trigger Event:
push
-
Statement type:
File details
Details for the file stateprobe-0.3.1-py3-none-any.whl.
File metadata
- Download URL: stateprobe-0.3.1-py3-none-any.whl
- Upload date:
- Size: 107.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1645fb4138d9ac2a2d3325dae5acd71b99c8bee4125e013755922c5673f1c0f3
|
|
| MD5 |
f8ec98aeb4739ee727eaf3b3ec2e3c0f
|
|
| BLAKE2b-256 |
5ea1965cbc8c845bcb6e9b3db764914d4faaca4001bfad0c9e38471a1e12129e
|
Provenance
The following attestation bundles were made for stateprobe-0.3.1-py3-none-any.whl:
Publisher:
publish.yml on Erye932/stateprobe
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
stateprobe-0.3.1-py3-none-any.whl -
Subject digest:
1645fb4138d9ac2a2d3325dae5acd71b99c8bee4125e013755922c5673f1c0f3 - Sigstore transparency entry: 1615291120
- Sigstore integration time:
-
Permalink:
Erye932/stateprobe@b7216377f1295902ec655b884019b8fec8bd66ea -
Branch / Tag:
refs/tags/v0.3.1 - Owner: https://github.com/Erye932
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@b7216377f1295902ec655b884019b8fec8bd66ea -
Trigger Event:
push
-
Statement type: