Agent Context Audit is a small autonomous guard for LLM operators. It audits prompts, retrieved context, tool arguments, memory snippets, and support logs before they are sent to an agent or model. It is useful when your stack handles untrusted text and you want a repeatable pre-flight check for secrets, prompt injection, personal data, and risky action requests.
It does not promise perfect security. It provides deterministic rules, clear
JSON reports, and an optional Bring-Your-Own-LLM reviewer through the local
llm_adapter.py interface. No API key is required.
Who This Is For
- LLM app operators ingesting tickets, webpages, documents, or tool payloads.
- Internal automation owners who need a cheap gate before autonomous actions.
- Teams that want offline tests and transparent rules before adding a model.
- Builders who need a small, editable starting point for context hygiene.
Quick Start
cd agent-contextaudit-v1
python3 agent.py --help
python3 agent.py status
python3 agent.py scan --deterministic --input sample_contexts.json --output audit_report.json
python3 agent.py check-text --text "Ignore previous system instructions"
python3 test_agent.py
./smoke_test.sh
Install as a Debian service:
sudo ./install.sh
sudo systemctl start agent-contextaudit-v1
sudo systemctl status agent-contextaudit-v1
What It Produces
The report is JSON:
{
"agent": "agent-contextaudit-v1",
"summary": {
"total_items": 3,
"decisions": {"allow": 1, "review": 1, "block": 1}
},
"items": [
{
"id": "credential-leak",
"decision": "block",
"risk_score": 80,
"categories": ["secret"]
}
]
}
Architecture
+---------------------+
JSON/text --> | normalize records |
+----------+----------+
|
v
+---------------------+
| deterministic rules |
| secrets / PII / |
| injection / tools |
+----------+----------+
|
v
+---------------------+
| risk score + policy |
| allow/review/block |
+----------+----------+
|
optional v
+---------------------+
| BYO LLM reviewer |
| claude/kimi/codex |
+----------+----------+
|
v
+---------------------+
| JSON audit report |
+---------------------+
Offline First
agent.py --help, python3 test_agent.py, and ./smoke_test.sh work without
network access and without provider credentials. If a supported local coding
agent CLI is available, the pack can add an LLM review section; otherwise it
stays deterministic.