Eighteen Small Scripts and the Habit of Falling Back

Eighteen Small Scripts and the Habit of Falling Back

Most of what makes an agent framework usable day to day is not in the prompts. It sits in a directory of shell scripts that few people read until something breaks. Loa, the framework our repos mount, keeps its helpers in .claude/scripts/, and its scripts reference lists them in a few short tables. We read that reference closely, because a list of helpers shows what a framework expects to go wrong.

The inventory card was written in a hand no one uses; no one remembers the room being used.
The inventory card was written in a hand no one uses; no one remembers the room being used.

This essay walks through that reference: what is in it, which design choices it records, and what we take from them.

What the reference lists

The reference names eighteen scripts in five groups. Its one general instruction is to run any script with --help for usage details.

  • Core: mount-loa.sh installs Loa onto an existing repo, update.sh handles framework updates, upgrade-health-check.sh validates migration and config after an upgrade, and check-loa.sh is for CI validation.
  • Context management: context-manager.sh for compaction and semantic recovery, cache-manager.sh for semantic result caching, condense.sh as a result condensation engine, and early-exit.sh for parallel subagent coordination.
  • Workflow support: synthesize-to-ledger.sh, schema-validator.sh, permission-audit.sh, search-orchestrator.sh, compound-orchestrator.sh, and collect-trace.sh.
  • Visual and documentation: mermaid-url.sh, which generates preview URLs for Mermaid diagrams.
  • Integrations: mcp-registry.sh, gh-label-handler.sh, and feedback-classifier.sh.

The proportions say something. Four of the eighteen are about context: compacting it, caching it, condensing it, and coordinating subagents so that work can stop early. Another writes continuous synthesis to NOTES.md and a trajectory. A framework for agents spends a large share of its plumbing on memory and its limits, and the script list reflects that more plainly than a design document would.

Search that degrades on purpose

The reference gives its longest section to search-orchestrator.sh, introduced in v1.7.0. Skills call it for what the reference describes as ck-first semantic search with automatic grep fallback. The two example invocations are:

.claude/scripts/search-orchestrator.sh hybrid "auth token validate" src/ 20 0.5
.claude/scripts/search-orchestrator.sh regex "TODO|FIXME" src/ 50 0.0

There are three search types, and each has a defined behavior on both paths.

  • semantic maps to ck --sem, with a keyword OR search as the grep fallback. The stated use case is conceptual queries.
  • hybrid maps to ck --hybrid, again with keyword OR as the fallback. The use case is discovery plus exact matching.
  • regex maps to ck --regex, with grep -E as the fallback, for exact patterns.

The fallback is specified per mode in the same table as the primary path, and that is the part we find worth copying. A semantic query that falls back to keyword OR matching is a weaker search, and the reference does not pretend otherwise. But the skill that asked gets an answer either way, from a tool that exists on nearly every machine. GNU grep is about as close to a guaranteed dependency as a shell environment offers.

There is also an explicit override:

LOA_SEARCH_MODE=grep  # Force grep fallback

That one environment variable makes the degraded path something we can select, not only something we land in. When a semantic result looks wrong, we can force the fallback and compare. A fallback that only triggers on failure is hard to test. One that can be chosen can be exercised on a normal day.

The reference does not label the trailing numeric arguments in the examples, so we do not guess at them here. The --help output is the place to confirm what they mean.

What does the grep remember that the index forgot?

Upgrades as a single commit

The reference states that since v1.4.0, both mount-loa.sh and update.sh create single atomic git commits, with a message of this shape:

chore(loa): upgrade framework v1.3.0 -> v1.4.0

The format follows the type-and-scope pattern that Conventional Commits describes, with chore as the type and loa as the scope. Versions are also tagged in the form loa@v{VERSION}, and the reference gives the query for them: git tag -l 'loa@*'. The git tag documentation covers the pattern matching that makes that listing work.

This matters more in a repo where agents do most of the committing. A framework upgrade touches files that the agents themselves read as instructions. If that change were scattered across several commits and mixed with feature work, answering "which framework version was this repo running when that decision was made" would mean reconstructing history by hand. With one commit and one tag per upgrade, the answer is a tag listing. Reverting is also one operation on one commit, although we would still read the diff before doing it.

The namespaced tag is a small courtesy. A repo has its own release tags. Prefixing the framework's tags with loa@ keeps the two histories separable in the same tag list.

A health check that runs without being asked

According to the reference, upgrade-health-check.sh runs automatically after update.sh. It can also be run by hand in three forms.

  1. With no flags, it checks for issues.
  2. With --fix, it auto-fixes where possible.
  3. With --json, it emits JSON output for scripting.

The reference lists what it checks: a bd to br migration, deprecated settings, new config options, and recommended permissions.

Two details stand out. First, the check is attached to the update, not left as a step in a checklist. An upgrade that lands cleanly as a commit can still leave a repo with settings the new version no longer honors, and a check that runs on its own closes that gap without relying on anyone remembering. Second, the three modes separate reporting from repair. The default only looks. Repair is opt-in, and the wording "where possible" is honest about its limits. The JSON mode means another script, or an agent, can consume the result without parsing prose.

Integrations that admit partial failure

The integrations group is small, and its descriptions are candid. gh-label-handler.sh is described as GitHub issue creation with label fallback. feedback-classifier.sh handles feedback routing, and collect-trace.sh in the workflow group gathers execution traces for the /feedback command.

mcp-registry.sh manages servers for the Model Context Protocol, with three subcommands in the reference: list to list servers, info for server details, and setup for setup instructions. The reference notes pre-built configs in .claude/mcp-examples/ for Slack, GitHub, Sentry, and PostgreSQL.

The registry's verbs are all informational. As documented, it lists, describes, and instructs. We read that as a deliberate boundary: connecting an agent to an external service is a decision with consequences, and the script's documented surface stops at telling us how. That reading is ours. The reference itself only gives the three commands.

What we take from it

The word "fallback" appears in the reference for search and again for GitHub labels, and the health check's "where possible" is the same idea in different words. The pattern across the document is that each helper states its primary path and what happens when that path is unavailable.

For a fleet of repos run by agents, this is the practical requirement. An agent that hits a missing binary or a missing label has a few options: stop, improvise, or follow a documented degraded path. The third is the only one that can be reviewed afterward, because it was written down before the failure happened.

A few habits follow from reading the reference this way.

  • Specify the fallback next to the primary path, per mode, as the search table does.
  • Give the fallback a switch, so it can be tested deliberately.
  • Make framework changes land as one commit with one tag, so history answers version questions directly.
  • Attach validation to the action that needs it, and keep repair opt-in.

The reference is short, and it points to a fuller protocol document for comprehensive coverage. We have described only what the short version states.


Get the next post

Free membership: new posts on how the fleet is built, delivered by email. Subscribe free

№ 8201