Skip to content

Commit 6bf0a7b

Browse files
committed
Improve Agent Harness section with workflow steps and richer JSON example
1 parent a3c0c05 commit 6bf0a7b

1 file changed

Lines changed: 20 additions & 10 deletions

File tree

README.md

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -65,33 +65,43 @@ context-profiler diagnose trace.json --format auto --json
6565

6666
## Agent Harness
6767

68-
Agents use the CLI to discover formats, validate input, and get structured diagnosis:
68+
Agents use the CLI to discover, validate, and diagnose — all outputs are stable JSON contracts with error codes and next-step guidance.
6969

7070
```bash
71-
context-profiler formats list --json # discover supported formats
72-
context-profiler validate trace.json --json # check before analyzing
73-
context-profiler diagnose trace.json --json # structured issues + evidence
71+
# 1. Discover what formats are supported
72+
context-profiler formats list --json
73+
74+
# 2. Validate before analyzing (returns error codes + agent_action if invalid)
75+
context-profiler validate trace.json --format auto --json
76+
77+
# 3. Diagnose: structured issues with evidence
78+
context-profiler diagnose trace.json --format auto --json
7479
```
7580

76-
Example diagnosis output:
81+
Agents get actionable contracts, not just error messages:
7782

7883
```json
7984
{
8085
"issues": [
8186
{
8287
"code": "TOOL_INPUT_BLOAT",
8388
"severity": "critical",
84-
"message": "Tool inputs (not results) consume a large share of context.",
85-
"evidence": { "tool_input_tokens": 595, "ratio": 0.752 },
86-
"recommendation": "Consider using artifact references or shorter identifiers."
89+
"evidence": { "tool_input_tokens": 6234, "ratio": 0.72 },
90+
"recommendation": "Use artifact references instead of full payloads."
91+
}
92+
],
93+
"diff_hints": [
94+
{
95+
"type": "possible_artifact_churn",
96+
"evidence": { "artifact_key": "src/app.tsx", "modifications": 4 }
8797
}
8898
]
8999
}
90100
```
91101

92-
Issue codes: `TOOL_INPUT_BLOAT`, `TOOL_RESULT_DOMINATES`, `TOP_TOOL_CONTEXT_HOTSPOT`, `REPEATED_CONTENT_BLOCK`, `REPEATED_TOOL_INPUT`, `STATIC_CONTEXT_BLOAT`
102+
**Issue codes**: `TOOL_INPUT_BLOAT` · `TOOL_RESULT_DOMINATES` · `TOP_TOOL_CONTEXT_HOTSPOT` · `REPEATED_CONTENT_BLOCK` · `REPEATED_TOOL_INPUT` · `STATIC_CONTEXT_BLOAT`
93103

94-
This repo also ships an [`analyze-agent-context`](skills/analyze-agent-context/SKILL.md) skill for Cursor, Claude Code, and Open Plugins compatible tools.
104+
**Agent skill**: This repo ships an [`analyze-agent-context`](skills/analyze-agent-context/SKILL.md) skill for Cursor, Claude Code, and Open Plugins compatible tools — agents learn to fetch traces and route them into `context-profiler` automatically.
95105

96106
## Supported Inputs
97107

0 commit comments

Comments
 (0)