Skip to content
Back to skills

Locate

ASecurity

Find this session's context-usage record and the rein command on PATH. Use when you need to know how much of the context this session has used, or which rein command a handover request will run -- rein does not print either at session start.

  • 2 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added November 9, 2026
ai-agentsshellbash

Works with

  • claude code

Security analysis

A100/100

Scanned December 4, 2026

npx -y skills add shasyasan/claude-rein --skill locate --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Locate?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Locate
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/shasyasan-locate/badge)](https://www.skillsdirectory.com/skills/shasyasan-locate)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: locate
description: Find this session's context-usage record and the rein command on PATH. Use when you need to know how much of the context this session has used, or which rein command a handover request will run -- rein does not print either at session start.
---

# Finding the usage record and the rein command

rein keeps these two out of the session start on purpose: most sessions never need them, so carrying them in every context costs more than looking them up on the one turn that does. Both vary per session and per machine, so **take them from the commands below, never from memory or a guess.**

## In a session rein launched

Run this as-is (it prints both, or stops with the reason):

```sh
: "${CLAUDE_CODE_SESSION_ID:?Claude Code did not pass this session its ID -- stop and ask the user for it}"
: "${REIN_MANAGED_CWD:?rein did not launch this session -- use the steps for a session rein did not launch}"
rein_cmd="$(command -v rein)" || { printf 'rein command: not on PATH (report this to the user)\n'; exit 1; }
printf 'rein command: %s\n' "$rein_cmd"
usage_dir="$(rein --cwd "$REIN_MANAGED_CWD" --config "$REIN_MANAGED_CONFIG_FILE" config get usage_state_dir)" || exit 1
printf 'usage record: %s/%s.json\n' "$usage_dir" "$CLAUDE_CODE_SESSION_ID"
```

- **The usage record** is `<usage_state_dir>/<session ID>.json` -- the same file rein's hooks read. `cat` it: the figure rein compares against its thresholds is `context_window.total_input_tokens` × 100 ÷ `context_window.context_window_size`, rounded -- the share of the model's context window. `used_percentage` is not that figure (from Claude Code 2.1.336 on, it is measured against the auto-compact window). `at` is when the status line last wrote it (an `at` far behind the clock means the number is old -- rein's hooks say so on their own once it passes `usage_stale_sec`).
- **The location comes from the lineage's own config.** A session rein launched carries the lineage's config file in `REIN_MANAGED_CONFIG_FILE`, and that is what the hooks read; running `rein config get` without `--config` would read the default user config instead, which is a different file for a lineage started with `--root` or `--config`.
- **The session ID comes from `CLAUDE_CODE_SESSION_ID`.** This rests on observation, not on a documented guarantee: Claude Code sets it in the shell its Bash tool runs, with the same value hooks receive as `session_id`. A subagent's shell carries its parent's ID, so a subagent reads the primary session's record. If it is unset, stop and ask -- **never put another session's ID in its place** (another session's record reads like a real answer).
- **The rein command** is whatever `rein` resolves to on PATH -- the same command a handover request runs (see `/rein:request`). If it is not on PATH, the installation is incomplete: hand that to the user rather than substituting another path.

## In a session rein did not launch

Without the variables above, name the project yourself:

```text
command -v rein
rein --cwd <absolute path to the target project> config get usage_state_dir
```

The record is `<printed location>/<this session's ID>.json`. If you don't know this session's ID, stop and ask.

## When a step fails

A non-zero exit means the location could not be resolved -- the reason is on stderr (for example, a project config nobody has decided on yet: `rein config get` refuses to run until it is allowed or denied). Report that reason to the user; don't fall back to a default path or a file you found by listing the directory.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.