headroom/docs
Tejas Chopra 5829602fa8 refactor!: remove rtk and lean-ctx CLI context tools
Both third-party CLI context tools are removed, and with them the
context-tool selector itself. Headroom no longer downloads, installs or
configures either one, and there is no replacement.

The previous pass (#2344) gated only three entry points inside
headroom/cli/wrap.py, which left the feature reachable in practice:

* scripts/install.sh and install.ps1 ran `rtk init --global --auto-patch`
  from bash/PowerShell, bypassing the Python gate entirely, so `curl | sh`
  still wrote a Claude Code PreToolUse hook regardless of HEADROOM_RTK.
* `wrap openhands` was broken by default: rtk_required=True met a gate
  returning None and raised SystemExit(1). Every openhands test patched
  _ensure_rtk_binary to a fake path, so it was invisible.
* The proxy shelled out to `rtk gain` from /stats, the dashboard and
  `headroom perf`, and the subscription tracker polled it per contribution.
* Nothing removed artifacts an earlier default had already installed, so a
  machine that once ran the old default kept rtk in the loop forever.

Removed: the headroom/rtk and headroom/lean_ctx packages,
headroom/cli/wrap_rtk_metrics.py, _selected_context_tool /
_setup_context_tool_for_agent / _VALID_CONTEXT_TOOLS, the --rtk, --no-rtk,
--no-project-rtk and --keep-rtk flags, HEADROOM_RTK*, the proxy-side gain
polling and the dashboard CLI-filtering panel.

--context-tool / --no-context-tool / HEADROOM_CONTEXT_TOOL survive only to
fail loudly. They live in shell profiles, aliases and CI jobs, and accepting
them as a no-op would read as Headroom having quietly stopped working. The
installers reject them too: their arg parsers forward the first unknown flag
*and everything after it* to the wrapped tool, so a leftover --no-rtk would
have silently swallowed a following --port and been ignored downstream.

Added headroom/context_tool_cleanup.py. Deleting the code cannot help a
machine that already ran the old default, so purge_context_tool_artifacts()
runs once per wrap/unwrap and removes the registered hook entries, the
generated hook scripts, the Headroom-managed ~/.local/bin symlinks, the
vendored ~/.headroom/bin/{rtk,lean-ctx} binaries, the lean-ctx MCP server
entry and the injected instruction fences. It is idempotent, skips a
malformed config rather than overwriting it, and only unlinks a symlink that
resolves inside Headroom's own bin dir, so a user's own build is untouched.
It reports on stderr, because `wrap/unwrap openclaw --prepare-only` emit
machine-readable JSON on stdout as their entire contract. It is skipped for
`wrap selfheal` (runs from a SessionStart hook, must not race Claude Code's
writer for ~/.claude.json) and for --help, which must stay read-only.

Also hardens the client-config writes this work touched. wrap.py reset a
settings file to {} when an existing file would not parse and then wrote
that back, turning one hand-edited typo or a transient read error into total
loss of a user's permissions/env/hooks on every `wrap claude`; it now
refuses to write. fsutil.write_text is atomic (temp file + fsync +
os.replace), which fixes all 14 non-atomic client-config writes at once,
follows symlinks rather than replacing them, and preserves an existing
file's mode.

rtk stays in the wrapper-peel list in transforms/content_router.py on
purpose: it sits beside sudo/env/timeout as shell-command grammar, so
`rtk cat f` is still classified as a file read for anyone running their own
rtk install, which the purge deliberately leaves alone.
2026-07-30 21:11:10 -07:00
..
app docs: improve discoverability for AI agents and search crawlers 2026-05-13 17:36:06 -07:00
components docs: sync Vercel docs with current code and add in-depth proxy config (#2475) 2026-07-21 16:26:56 -07:00
content/docs refactor!: remove rtk and lean-ctx CLI context tools 2026-07-30 21:11:10 -07:00
lib docs: sync Vercel docs with current code and add in-depth proxy config (#2475) 2026-07-21 16:26:56 -07:00
overrides fix: repair release and docs pipelines 2026-04-16 12:53:51 -05:00
screenshots Merge pull request #147 from JerrettDavis/feat/anthropic-usage-insights 2026-04-12 10:54:22 -07:00
.gitignore new docs UI + ts doc coverage 2026-04-12 13:15:58 +06:00
bun.lock fix(deps): remediate dependency CVEs and publish SBOM (#1509) 2026-06-27 15:28:12 -07:00
claude-code-bedrock-headroom.md fix(bedrock): route ARNs via converse, named AWS profiles, and au. re… (#1456) 2026-07-02 22:51:05 -05:00
next.config.mjs new docs UI + ts doc coverage 2026-04-12 13:15:58 +06:00
observability.md refactor!: remove rtk and lean-ctx CLI context tools 2026-07-30 21:11:10 -07:00
package-lock.json deps: bump the npm-minor-patch group across 3 directories with 7 updates (#2276) 2026-07-21 11:21:14 -05:00
package.json deps: bump the npm-minor-patch group across 3 directories with 7 updates (#2276) 2026-07-21 11:21:14 -05:00
platform-feature-matrix.json fix: harden persistent install startup (#1851) 2026-07-10 00:40:34 -04:00
platform-stabilization.md fix: harden persistent install startup (#1851) 2026-07-10 00:40:34 -04:00
postcss.config.mjs new docs UI + ts doc coverage 2026-04-12 13:15:58 +06:00
proxy.ts new docs UI + ts doc coverage 2026-04-12 13:15:58 +06:00
README.md new docs UI + ts doc coverage 2026-04-12 13:15:58 +06:00
source.config.ts docs(ci): add CI/CD flow diagrams (#1062) 2026-06-16 23:05:15 -07:00
tsconfig.json new docs UI + ts doc coverage 2026-04-12 13:15:58 +06:00
vercel.json fix: add Vercel deploy config and workflow for docs site (#1739) 2026-07-14 13:25:18 -04:00

docs

This is a Next.js application generated with Create Fumadocs.

Run development server:

npm run dev
# or
pnpm dev
# or
yarn dev

Open http://localhost:3000 with your browser to see the result.

Explore

In the project, you can see:

  • lib/source.ts: Code for content source adapter, loader() provides the interface to access your content.
  • lib/layout.shared.tsx: Shared options for layouts, optional but preferred to keep.
Route Description
app/(home) The route group for your landing page and other pages.
app/docs The documentation layout and pages.
app/api/search/route.ts The Route Handler for search.

Fumadocs MDX

A source.config.ts config file has been included, you can customise different options like frontmatter schema.

Read the Introduction for further details.

Learn More

To learn more about Next.js and Fumadocs, take a look at the following resources: