An agent uses the skill
This page shows the westering Agent Skill at work inside a real AI client. Claude Code 2.1.326, with the model claude-opus-5-5, ran in print mode in shipyard, a small synthetic project written for this page. The project held the skill at .claude/skills/westering/SKILL.md, a copy of skills/westering/SKILL.md, and a build of westering from this repository was first on the path. Three sessions ran, one prompt each, and every step of each is shown below. The first two reach westering through the skill and the shell, and the third through the MCP server that westering mcp serves.
The first two sessions ran with this command, each with its prompt in place of PROMPT.
claude -p "PROMPT" --output-format stream-json --verbose --setting-sources project --strict-mcp-config --no-session-persistence --max-budget-usd 3 --allowedTools "Read" "Grep" "Glob" "Write" "Skill" "Bash(westering:*)" "Bash(westering *)"
The allowed tools let the agent read and search the project, write a file, load a skill and run westering. The client also ran a few shell commands outside that list without asking, a directory listing in session 1 and a byte count in session 2, and refused the others. Each refusal is shown as the client returned it.
What was changed
The page is rendered from the stream of tool calls and results the client printed. Three kinds of change were made, and no other.
- A path that names the machine is replaced by a neutral name. The project folder is shown as /work/shipyard, and the scratch folder the client gave the agent is shown as /scratch.
- A long directory listing names the login that owns each file. That column is shown as owner, in the result of call 2 in session 1.
- This repository keeps em and en dashes out of its text files. Each one the client or the agent wrote is shown as its JSON escape,
\u2014for an em dash and\u2013for an en dash, in the result of call 9 in session 1 and in the final answer of session 2.
The trace the first agent wrote is committed as docs/media/agent-session-trace.json. The log the second agent read is committed as docs/media/earlier_session.jsonl, a copy of the synthetic example examples/logs/claude_code_session.jsonl under the name the session saw. A test in tests/launch.rs runs each westering command below that the client did not refuse, over those files, and fails unless it prints exactly the result shown here. It also runs the command that matches each call of the MCP tools in session 3 and fails unless the command prints the same document.
Session 1, the agent checks its own calls
The agent searches the project, then writes its own tool calls as a trace and runs the detectors over it.
Prompt
Find where the retry limit for uploads is configured in this project and what it is set to. When you have searched, use the westering skill to check your own tool calls in this session for a stall before you answer. Write them as a trace, run westering detect on it, and act on what it reports.
Tool calls
Call 1, Grep
{
"pattern": "(?i)retr(y|ies)",
"output_mode": "content"
}
It returned this.
No matches found
Call 2, Bash
{
"command": "ls -la; find . -type f | head -50",
"description": "List project files"
}
It returned this.
total 8
drwxr-xr-x@ 7 owner wheel 224 Dec 4 17:49 .
drwxr-xr-x@ 14 owner wheel 448 Dec 4 18:52 ..
drwxr-xr-x@ 3 owner wheel 96 Dec 4 17:48 .claude
-rw-r--r--@ 1 owner wheel 160 Dec 4 17:48 README.md
drwxr-xr-x@ 3 owner wheel 96 Dec 4 17:49 logs
drwxr-xr-x@ 3 owner wheel 96 Dec 4 17:48 src
drwxr-xr-x@ 3 owner wheel 96 Dec 4 17:48 tests
./tests/test_client.py
./.claude/skills/westering/SKILL.md
./README.md
./logs/earlier_session.jsonl
./src/uploader/defaults.json
./src/uploader/client.py
./src/uploader/__init__.py
./src/uploader/settings.py
Call 3, Bash
{
"command": "for f in README.md src/uploader/*.py src/uploader/defaults.json tests/test_client.py; do echo \"=== $f\"; cat \"$f\"; done",
"description": "Show project source files"
}
The client refused this call and returned this message.
A variable in this command can't be checked before it runs
Call 4, Read
{
"file_path": "/work/shipyard/src/uploader/settings.py"
}
It returned this.
1 import json
2 import os
3
4 DEFAULTS_PATH = os.path.join(os.path.dirname(__file__), "defaults.json")
5
6
7 def load_settings():
8 with open(DEFAULTS_PATH, encoding="utf-8") as handle:
9 return json.load(handle)
10
Call 5, Read
{
"file_path": "/work/shipyard/src/uploader/defaults.json"
}
It returned this.
1 {
2 "upload": {
3 "attempts": 5,
4 "backoff_seconds": 2
5 }
6 }
7
Call 6, Read
{
"file_path": "/work/shipyard/src/uploader/client.py"
}
It returned this.
1 import time
2
3 from .settings import load_settings
4
5
6 def upload(path, bucket):
7 settings = load_settings()
8 attempts = settings["upload"]["attempts"]
9 for attempt in range(attempts):
10 if _put(path, bucket):
11 return True
12 time.sleep(settings["upload"]["backoff_seconds"] * (attempt + 1))
13 return False
14
15
16 def _put(path, bucket):
17 # Stand in for the storage call in this synthetic project.
18 return False
19
Call 7, Read
{
"file_path": "/work/shipyard/README.md"
}
It returned this.
1 # shipyard
2
3 A small synthetic service that uploads finished build artifacts to a
4 storage bucket. Written for a westering demo session, with no real
5 data in it.
6
The agent wrote this between calls.
Found it. Now the westering check.
Call 8, Skill
{
"skill": "westering"
}
It returned this.
Launching skill: westering
The client then gave the agent a line naming the folder of the skill, Base directory for this skill: /work/shipyard/.claude/skills/westering, and the text of SKILL.md below its frontmatter, which is the same as in skills/westering/SKILL.md in this repository and is not repeated here.
Call 9, Write
{
"file_path": "/scratch/trace.json",
"content": "{\n \"trace_id\": \"upload-retry-search\",\n \"goal\": \"Find where the upload retry limit is configured and its value\",\n \"tools_available\": [\"grep\", \"bash\", \"read\", \"skill\"],\n \"events\": [\n {\"step\": 0, \"tool\": \"grep\", \"call\": \"grep(pattern=(?i)retr(y|ies))\", \"progress\": false},\n {\"step\": 1, \"tool\": \"bash\", \"call\": \"bash(ls -la; find . -type f)\", \"progress\": true},\n {\"step\": 2, \"tool\": \"bash\", \"call\": \"bash(cat project files loop)\", \"progress\": false},\n {\"step\": 3, \"tool\": \"read\", \"call\": \"read(path=src/uploader/settings.py)\", \"progress\": true},\n {\"step\": 4, \"tool\": \"read\", \"call\": \"read(path=src/uploader/defaults.json)\", \"progress\": true},\n {\"step\": 5, \"tool\": \"read\", \"call\": \"read(path=src/uploader/client.py)\", \"progress\": true},\n {\"step\": 6, \"tool\": \"read\", \"call\": \"read(path=README.md)\", \"progress\": false},\n {\"step\": 7, \"tool\": \"skill\", \"call\": \"skill(name=westering)\", \"progress\": true}\n ]\n}\n"
}
It returned this.
File created successfully at: /scratch/trace.json (file state is current in your context \u2014 no need to Read it back)
Call 10, Bash
{
"command": "westering detect --trace /scratch/trace.json",
"description": "Run westering stall detection on my trace"
}
It returned this.
{
"detections": [],
"trace_id": "upload-retry-search"
}
Call 11, Read
{
"file_path": "/work/shipyard/tests/test_client.py"
}
It returned this.
1 from uploader import upload
2
3
4 def test_upload_gives_up():
5 assert upload("build.tar", "artifacts") is False
6
Final answer
The upload retry limit is set in
src/uploader/defaults.json:3as"upload": {"attempts": 5}. A searched for "retry" found nothing because the setting is calledattempts, not retry.How it's used:
src/uploader/settings.py:7loadsdefaults.json. No environment variable or other file changes the value.src/uploader/client.py:8readssettings["upload"]["attempts"]and loopsfor attempt in range(attempts). That means 5 upload tries in total (the first plus 4 retries), not 5 retries.- Between tries it waits
backoff_seconds(2) × the attempt number: 2, 4, 6, 8 and 10 seconds. It also waits after the last failed try, so a failed upload takes about 30 seconds before it returnsFalse.Stall check: I wrote my 8 tool calls as a trace and ran
westering detecton it. It found no stalls:"detections": []. One step went nowhere: a shell command to print all the files was refused, so I read each file directly instead and didn't repeat it. Since nothing was reported, I didn't need to change approach. I also readtests/test_client.pyto confirm it doesn't override the limit. The trace is at/scratch/trace.json.
Session 2, the agent checks an earlier log
The agent runs the detectors over the log of an earlier session in the project and explains the stall they report.
Prompt
logs/earlier_session.jsonl is the transcript of an earlier agent session in this project. Use the westering skill to check it for stalls, and tell me what the agent should have done differently.
Tool calls
Call 1, Skill
{
"skill": "westering",
"args": "logs/earlier_session.jsonl"
}
It returned this.
Launching skill: westering
The client then gave the agent a line naming the folder of the skill, Base directory for this skill: /work/shipyard/.claude/skills/westering, and the text of SKILL.md below its frontmatter, which is the same as in skills/westering/SKILL.md in this repository and is not repeated here, followed by the line ARGUMENTS: logs/earlier_session.jsonl.
Call 2, Bash
{
"command": "westering detect --trace logs/earlier_session.jsonl --format auto; echo \"exit $?\"; westering import --trace logs/earlier_session.jsonl; echo \"exit $?\"",
"description": "Run stall detection and import on the session log"
}
The client refused this call and returned this message.
This Bash command contains multiple operations. The following part requires approval: echo "exit $?"
Call 3, Bash
{
"command": "westering detect --trace /work/shipyard/logs/earlier_session.jsonl --format auto",
"description": "Run stall detection on the session log"
}
It returned this.
{
"detections": [
{
"detail": "tool Grep made 4 of 4 calls with no progress while Glob, Read went unused",
"evidence_span": {
"end_step": 6,
"start_step": 3
},
"pattern": [
"Grep"
],
"shape": "tool_fixation",
"trace_id": "earlier_session"
}
],
"trace_id": "earlier_session"
}
Call 4, Bash
{
"command": "westering import --trace /work/shipyard/logs/earlier_session.jsonl",
"description": "Show the trace westering builds from the log"
}
It returned this.
{
"events": [
{
"call": "Glob(pattern=\"**/*.toml\")",
"progress": true,
"step": 0,
"tool": "Glob"
},
{
"call": "Read(file_path=\"config/cache.toml\")",
"progress": true,
"step": 1,
"tool": "Read"
},
{
"call": "Grep(path=\"src\", pattern=\"max_entries\")",
"progress": true,
"step": 2,
"tool": "Grep"
},
{
"call": "Grep(path=\"src\", pattern=\"cache_size\")",
"progress": false,
"step": 3,
"tool": "Grep"
},
{
"call": "Grep(path=\"src\", pattern=\"capacity\")",
"progress": false,
"step": 4,
"tool": "Grep"
},
{
"call": "Grep(path=\"src\", pattern=\"CACHE_LIMIT\")",
"progress": false,
"step": 5,
"tool": "Grep"
},
{
"call": "Grep(path=\"src\", pattern=\"lru\")",
"progress": false,
"step": 6,
"tool": "Grep"
}
],
"goal": "Find where the cache size limit is configured.",
"tools_available": [
"Glob",
"Read",
"Grep"
],
"trace_id": "earlier_session"
}
Call 5, Bash
{
"command": "wc -c /work/shipyard/logs/earlier_session.jsonl",
"description": "Check the log file size"
}
It returned this.
2311 /work/shipyard/logs/earlier_session.jsonl
Call 6, Read
{
"file_path": "/work/shipyard/logs/earlier_session.jsonl"
}
It returned this.
1 {"type":"summary","summary":"Find the cache size limit","synthetic":true,"note":"Written by hand for the westering examples. No real session."}
2 {"type":"user","message":{"role":"user","content":"Find where the cache size limit is configured."}}
3 {"type":"assistant","message":{"role":"assistant","content":[{"type":"tool_use","id":"toolu_01","name":"Glob","input":{"pattern":"**/*.toml"}}]}}
4 {"type":"user","message":{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_01","content":"Cargo.toml\nconfig/cache.toml"}]}}
5 {"type":"assistant","message":{"role":"assistant","content":[{"type":"tool_use","id":"toolu_02","name":"Read","input":{"file_path":"config/cache.toml"}}]}}
6 {"type":"user","message":{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_02","content":"1\t[cache]\n2\tbackend = \"memory\"\n3\tttl_seconds = 300"}]}}
7 {"type":"assistant","message":{"role":"assistant","content":[{"type":"tool_use","id":"toolu_03","name":"Grep","input":{"pattern":"max_entries","path":"src"}}]}}
8 {"type":"user","message":{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_03","content":"No matches found"}]}}
9 {"type":"assistant","message":{"role":"assistant","content":[{"type":"tool_use","id":"toolu_04","name":"Grep","input":{"pattern":"cache_size","path":"src"}}]}}
10 {"type":"user","message":{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_04","content":"No matches found"}]}}
11 {"type":"assistant","message":{"role":"assistant","content":[{"type":"tool_use","id":"toolu_05","name":"Grep","input":{"pattern":"capacity","path":"src"}}]}}
12 {"type":"user","message":{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_05","content":"No matches found"}]}}
13 {"type":"assistant","message":{"role":"assistant","content":[{"type":"tool_use","id":"toolu_06","name":"Grep","input":{"pattern":"CACHE_LIMIT","path":"src"}}]}}
14 {"type":"user","message":{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_06","content":"No matches found"}]}}
15 {"type":"assistant","message":{"role":"assistant","content":[{"type":"tool_use","id":"toolu_07","name":"Grep","input":{"pattern":"lru","path":"src"}}]}}
16 {"type":"user","message":{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_07","content":"No matches found"}]}}
17
Final answer
westering found one stall in
logs/earlier_session.jsonl: the agent kept calling Grep instead of changing approach. The file's first line says it was written by hand as a westering example, so this is a sample session rather than a real one.What the tool reported
- Type: tool fixation, with Grep as the repeated tool.
- Where: steps 3\u20136, which is four Grep calls in a row with no progress, while Glob and Read went unused.
What happened The task was "Find where the cache size limit is configured."
- Glob
**/*.tomlfoundCargo.tomlandconfig/cache.toml.- Read
config/cache.tomlshowed onlybackend = "memory"andttl_seconds = 300. There was no size setting.- Grep in
srcformax_entries,cache_size,capacity,CACHE_LIMITandlrureturned "No matches found" all five times.westering counts step 2's
max_entriessearch as progress only because it was the first Grep result. It also found nothing, so in practice the agent was stuck for five calls, not four. The session ends with no answer and no report of what was searched.What the agent should have done differently
- Questioned the search scope after the first or second miss. Every Grep searched
path="src". When several unrelated words all return nothing, the problem is probably where it's searching, not which word it picked. It should have searched the whole repo, or used Glob to see which directories and files exist.- Gone back to the config files. The cache config lists
backend = "memory", so the next step was to find the code that readsconfig/cache.toml(for example, a Grep forcache.tomlorttl_seconds). The size limit is probably set there, as a default or a constructor argument, or the memory backend has no limit at all.- Checked
Cargo.toml. Glob had already found it. A dependency such aslru,mokaorcachedwould tell it which library's size setting to look for. The agent never opened the file.- Used one search instead of five. Something like
max_entries|cache_size|capacity|CACHE_LIMIT|lru, case-insensitive and across the whole repo, does the same work in one call.- Stopped and reported. If none of that turned anything up, "No size limit is configured;
config/cache.tomlonly sets backend and TTL" is a useful answer. Ending on a run of empty searches is not.In westering's terms the agent never took even the first fix, which is to try a different approach after a couple of failures. Here the different approach was searching wider or reading other files.
Session 3, the agent uses the MCP server
The third session gave the client westering mcp as its one MCP server and allowed the two tools it serves and Read. It ran with this command.
claude -p "PROMPT" --output-format stream-json --verbose --setting-sources project --strict-mcp-config --mcp-config '{"mcpServers":{"westering":{"type":"stdio","command":"westering","args":["mcp"]}}}' --no-session-persistence --max-budget-usd 3 --allowedTools "mcp__westering__detect" "mcp__westering__intervene" "Read"
The client's first line of output reports the server westering as connected, with the tools mcp__westering__detect and mcp__westering__intervene. The client hands the agent the result of each tool call as compact JSON. In call 1 the agent searches for the two tools with the client's ToolSearch tool, which loads them so the agent can call them. The allowed tools do not name ToolSearch, and the client ran it without asking.
Prompt
logs/earlier_session.jsonl is the transcript of an earlier agent session in this project. Use the detect tool of the westering MCP server to check it for stalls, reading it with the format auto. Then use the server's intervene tool to run the scenario the detection suggests, the one whose name matches the stall it found, and tell me which rung cleared it.
Tool calls
Call 1, ToolSearch
{
"query": "select:mcp__westering__detect,mcp__westering__intervene",
"max_results": 2
}
It returned this.
[
{
"type": "tool_reference",
"tool_name": "mcp__westering__detect"
},
{
"type": "tool_reference",
"tool_name": "mcp__westering__intervene"
}
]
Call 2, mcp__westering__detect
{
"path": "logs/earlier_session.jsonl",
"format": "auto"
}
It returned this.
{"detections":[{"detail":"tool Grep made 4 of 4 calls with no progress while Glob, Read went unused","evidence_span":{"end_step":6,"start_step":3},"pattern":["Grep"],"shape":"tool_fixation","trace_id":"earlier_session"}],"trace_id":"earlier_session"}
Call 3, mcp__westering__intervene
{
"scenario": "fixation-clears-on-nudge"
}
It returned this.
{"cleared_by":"nudge","detections":[{"detail":"tool grep made 4 of 4 calls with no progress while read, edit, test, finish went unused","evidence_span":{"end_step":3,"start_step":0},"pattern":["grep"],"shape":"tool_fixation","trace_id":"sandbox-fixation-clears-on-nudge"}],"events":[{"call":"grep(pattern=config, path=src)","progress":false,"step":0,"tool":"grep"},{"call":"grep(pattern=settings, path=src)","progress":false,"step":1,"tool":"grep"},{"call":"grep(pattern=config, path=docs)","progress":false,"step":2,"tool":"grep"},{"call":"grep(pattern=conf, path=src)","progress":false,"step":3,"tool":"grep"},{"call":"read(path=src/config.py)","progress":true,"step":4,"tool":"read"},{"call":"test(target=config)","progress":true,"step":5,"tool":"test"},{"call":"finish(summary=config located)","progress":true,"step":6,"tool":"finish"}],"goal":"Find the config file and report its path","interventions":[{"at_step":3,"fired_by":{"evidence_span":{"end_step":3,"start_step":0},"pattern":["grep"],"shape":"tool_fixation","trace_id":"sandbox-fixation-clears-on-nudge"},"message":"Stop. Your recent work stalled in the shape tool_fixation. Change approach and work toward the goal. The goal is Find the config file and report its path.","rung":"nudge"}],"outcome":"cleared","session_id":"sandbox-fixation-clears-on-nudge","stall_cleared":true}
Final answer
The first rung, the nudge, cleared it.
What the detection found: I read
logs/earlier_session.jsonlwith the format set to auto and found one stall, a tool fixation on Grep. From step 3 to step 6, Grep made 4 calls in a row and none of them made progress, while Glob and Read went unused.The scenario run:
fixation-clears-on-nudgeis the only scenario named for this kind of stall, so I ran that one. Note that it's a scripted sandbox run, not a replay of your session.
- The agent made 4 Grep calls in a row that made no progress. The detector flagged it at step 3.
- At step 3 the ladder fired its nudge: "Stop. Your recent work stalled in the shape tool_fixation. Change approach…"
- The agent then switched to read, test and finish, and each of those calls made progress.
- The run ended with the stall marked as cleared and no higher rung needed.