AgentStack
SKILL verified MIT Self-run

Selfaware

skill-sorbh-claude-selfaware-claude-selfaware · by Sorbh

>

No reviews yet
0 installs
16 views
0.0% view→install

Install

$ agentstack add skill-sorbh-claude-selfaware-claude-selfaware

✓ scanned · ✓ verified — works with Claude Code, Cursor, and more.

Security review

✓ Passed

No issues found. Passed automated security review. · v0.1.0 How review works →

  • Prompt-injection patterns
  • Secret / credential exfiltration
  • Dangerous shell & filesystem operations
  • Untrusted network calls
  • Known-malicious package signatures

What it can access

  • Network access No
  • Filesystem access No
  • Shell / process execution No
  • Environment & secrets No
  • Dynamic code execution No

From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.

Are you the author of Selfaware? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

Claude Selfaware

You have real-time awareness of your own API usage and manage it intelligently — including offloading work to Codex when you're running low. Usage is checked automatically by hooks; your job is to act on what they inject.

How checks reach you (hooks)

Two hooks run usage-hook.sh for you — you don't call them:

  • SessionStart — at session start, surfaces any TASK_STATE.md checkpoint to resume.
  • UserPromptSubmit — before every reply, re-checks usage.

They stay silent at OK/MODERATE and only inject a `` directive once you reach WARNING (80%) or above. So: if you see no usage note, you have plenty of capacity — just work. When a directive appears, follow it (delegate / checkpoint / push through).

Manual check

You can still read usage on demand (the hooks use the same script):

~/.claude/skills/selfaware/scripts/usage-check.sh

Outputs:


  
    42%
    2026-06-24T18:30:00Z
    87
  
  
    67%
    2026-06-29T12:00:00Z
  
  
    23%
  
  true
  false
  OK | MODERATE | WARNING | CRITICAL | CRITICAL_BUFFER | UNKNOWN
  ...

When you might check manually

The hooks cover the routine cadence. Run usage-check.sh yourself only when you want a reading mid-task that the hook hasn't surfaced — e.g. before starting something large (know your budget first), or when the user asks about usage. The script caches for 2 minutes, so an occasional manual check is cheap.

How To Act By Status

OK (under 60%)

Full speed. Don't mention usage to the user.

MODERATE (60-79%)

Work normally, stay efficient. No need to mention usage.

WARNING (80-89%) — DELEGATE TO CODEX

This is the key behavior. When you cross 80%:

  1. Check ``.
  • If true: Automatically delegate suitable tasks to Codex to conserve Claude tokens.

You decide which tasks — no need to ask the user (they pre-approved auto-delegation).

  • If false: Can't offload. Just wrap up efficiently and prepare to checkpoint.
  1. Pick the RIGHT tasks for Codex. Good candidates are independent, well-specified,

and verifiable:

  • Boilerplate generation (CRUD, config files, type definitions)
  • Writing tests for already-written code
  • Repetitive edits across files (rename, format, mechanical refactors)
  • Self-contained functions with clear specs
  • Documentation generation

Keep for yourself (don't delegate) tasks that are:

  • Architectural or design decisions
  • Anything needing context from this conversation Codex won't have
  • Security-sensitive logic
  • Tasks where verifying Codex's output costs as much as doing it yourself
  1. Delegate with:

``bash ~/.claude/skills/selfaware/scripts/codex-delegate.sh "clear, complete task description" /path/to/project `` Give Codex a complete, self-contained prompt — it doesn't see this conversation. Include file paths, requirements, and what "done" looks like.

  1. Review what Codex returns. Verify it (run tests, read the diff). If good, continue.

If wrong, fix it yourself or re-delegate with clearer instructions.

  1. Tell the user once: "Usage at X% — I've handed [task] to Codex to conserve tokens."

CRITICAL (90%+) — STOP WITH BUFFER

  1. Mostly stop. Don't start new work. Keep a buffer of remaining capacity.
  2. Write TASK_STATE.md immediately (template below).
  3. Tell the user: what's done, what remains, when it resets, how to resume.
  4. Stop after saving state.

CRITICAL_BUFFER (90%+ but 5h resets in ≤30 min) — PUSH THROUGH

Special case: if the 5-hour window is over 90% but resets within 30 minutes AND the weekly window is still healthy, the script returns CRITICAL_BUFFER. This means:

  • You MAY keep working carefully through the remaining buffer, since the window

refreshes shortly anyway.

  • Still keep a TASK_STATE.md ready in case you hit a hard wall.
  • Don't start large new operations — finish what's in flight.
  • This only applies when reset_soon=true and weekly usage is NOT critical.

UNKNOWN

Script couldn't fetch data. Work normally, check again at next milestone. If repeated, tell the user the usage check isn't working.

TASK_STATE.md

Write to project root when checkpointing:

# Task State Checkpoint
> Saved at: [timestamp]
> Usage: [five_hour]% (5h) / [seven_day]% (7d)
> Resets at: [resets_at]

## Task
[One-line goal]

## Status: IN_PROGRESS

## Done
- [Completed item, with enough detail to verify]

## In Progress
- [What was being worked on and its current state]

## Delegated to Codex
- [Any tasks handed to Codex and their status]

## Next Steps
1. [Exact next action — specific enough for a fresh session]
2. [...]

## Files Touched
- `path/to/file` — [what changed]

## Resume Instructions
[What to do first when resuming]

Quality matters. Bad: "Was working on auth." Good: "Added JWT verify to src/auth.ts:45-80. Refresh logic written, untested. Next: npm test -- --grep auth."

Session Start Protocol

The SessionStart hook already checks usage and, if a TASK_STATE.md exists, injects a note telling you to resume. When you see that note: read TASK_STATE.md, tell the user what you're resuming, verify the recorded state, and continue from its Next Steps. If no note appears, just proceed with the user's request.

Marathon sessions (claude-m)

The user can launch a long unattended run with claude-m — it opens you inside a tagged tmux session watched by a shared background daemon. When usage hits the 5-hour limit the daemon sends you a wrap-up message: checkpoint to TASK_STATE.md and stop. After the window resets it sends a resume nudge. So in a marathon, treat any "checkpoint and pause" message as a hard signal to save state immediately — that's your only chance before the wall.

The Keep-Alive (background, not your concern)

A separate keepalive.sh runs via a launchd agent (surviving sleep and reboot) to ping Claude — and Codex if enabled and working — every 5 hours with a tiny dummy prompt, keeping the rolling windows warm. It skips when usage is already above 70%. You don't invoke this — it runs independently. Just know it exists if the user asks why their session stays active.

Weekly Limit Awareness

If seven_day is above 80% even when five_hour is low:

  • Tell the user: "Weekly usage is at X%. Capacity now but we should prioritize."
  • Lean harder on Codex delegation to stretch the weekly budget.
  • Avoid Opus-heavy operations if opus_seven_day is also high.

Rules

  • Never fabricate usage numbers. Only report what the script returns.
  • Don't mention usage when OK/MODERATE. One mention at WARNING, clear comms at CRITICAL.
  • At 80%+, delegate to Codex automatically when available — that's the whole point.
  • Give Codex complete, self-contained prompts — it has zero conversation context.
  • Always verify Codex output before building on it.
  • Respect the 30-min buffer rule — CRITICAL_BUFFER means keep going, plain CRITICAL means stop.
  • Always be ready to checkpoint — usage can jump 10%+ in one heavy operation.
  • Delete TASK_STATE.md when a resumed task completes.

Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet — be the first.

Versions

  • v0.1.0 Imported from the upstream source.