Expansion Grant Guard logo

Expansion Grant Guard

Community
ArchieIndian
expansion-grant-guard

YAML-based delegation grant ledger — issues, validates, and tracks scoped permission grants for sub-agent expansions with token budgets and auto-expiry.

Overview

PublisherArchieIndian
Repositoryopenclaw-superpowers
Skill nameexpansion-grant-guard
Stars
74
Forks
14
Bundled files
3
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 3 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by ArchieIndian on GitHub. Read the source before you install it.

Installation

Install the Expansion Grant Guard AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/ArchieIndian/openclaw-superpowers/tree/main/skills/openclaw-native/expansion-grant-guard
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/ArchieIndian/openclaw-superpowers.git /tmp/openclaw-superpowers
mkdir -p .claude/skills
cp -r /tmp/openclaw-superpowers/skills/openclaw-native/expansion-grant-guard .claude/skills/expansion-grant-guard
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Expansion Grant Guard in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Expansion Grant Guard on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Expansion Grant Guard is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Expansion Grant Guard

What it does

When an agent delegates work to a sub-agent (or expands context via DAG recall), it needs a controlled way to grant scoped permissions. Expansion Grant Guard maintains a YAML-based grant ledger that issues time-limited, token-budgeted grants — ensuring sub-agent operations stay within defined boundaries.

Inspired by lossless-claw's delegation grant system, where a parent agent issues a signed grant specifying what a sub-agent can access, how many tokens it may consume, and when the grant expires.

When to invoke

  • Before any sub-agent expansion or delegation — issue a grant first
  • When a sub-agent requests resources — validate the grant before proceeding
  • When checking token budgets — verify remaining budget in the grant
  • Periodically to clean up expired grants — auto-expiry sweep

How to use

bash
python3 guard.py --issue --scope "dag-recall" --budget 4000 --ttl 30   # Issue a grant
python3 guard.py --validate <grant-id>                                  # Check if grant is valid
python3 guard.py --consume <grant-id> --tokens 500                     # Record token usage
python3 guard.py --revoke <grant-id>                                    # Revoke a grant early
python3 guard.py --list                                                 # List all active grants
python3 guard.py --sweep                                                # Clean up expired grants
python3 guard.py --audit                                                # Full audit log
python3 guard.py --stats                                                # Grant statistics
python3 guard.py --status                                               # Current status summary
python3 guard.py --format json                                          # Machine-readable output

Grant structure

Each grant is a YAML entry in the ledger:

yaml
grant_id: "g-20260316-001"
scope: "dag-recall"           # What the grant allows
issued_at: "2026-03-16T10:00:00Z"
expires_at: "2026-03-16T10:30:00Z"
token_budget: 4000            # Max tokens allowed
tokens_consumed: 1250         # Tokens used so far
status: active                # active | expired | revoked | exhausted
issuer: "parent-session"
metadata:
  query: "auth migration"
  reason: "Recalling auth decisions for new implementation"

Grant lifecycle

Issue → Active → { Consumed | Expired | Revoked | Exhausted }
  │                    │
  │                    ├─ tokens_consumed < budget → still active
  │                    ├─ tokens_consumed >= budget → exhausted
  │                    ├─ now > expires_at → expired
  │                    └─ explicit revoke → revoked
  │
  └─ Validation checks: status=active AND not expired AND budget remaining

Procedure

Step 1 — Issue a grant before expansion

bash
python3 guard.py --issue --scope "dag-recall" --budget 4000 --ttl 30

Output:

Grant Issued
─────────────────────────────────────────────
  Grant ID:     g-20260316-001
  Scope:        dag-recall
  Token budget: 4,000
  Expires:      2026-03-16T10:30:00Z (in 30 min)
  Status:       active

Step 2 — Validate before consuming resources

bash
python3 guard.py --validate g-20260316-001

Returns status, remaining budget, and time until expiry. Non-zero exit code if invalid.

Step 3 — Record token consumption

bash
python3 guard.py --consume g-20260316-001 --tokens 1250

Deducts from the grant's remaining budget. Fails if exceeding budget.

Step 4 — Sweep expired grants

bash
python3 guard.py --sweep

Marks all expired grants and cleans up the active list.

Scope types

  • dag-recall — Permission to walk DAG nodes and assemble answers
  • session-search — Permission to search session persistence database
  • file-access — Permission to read externalized large files
  • context-expand — Permission to expand context window with external data
  • tool-invoke — Permission to invoke external tools/MCP servers
  • Custom scopes accepted — any string is valid

Integration with other skills

  • dag-recall: Should issue a grant before expanding DAG nodes; checks budget during expansion
  • session-persistence: Grant-gated search — validate grant before querying message database
  • large-file-interceptor: Grant-gated file restore — validate before loading large files back
  • context-assembly-scorer: Token budget tracking feeds into assembly scoring

State

Grant ledger and audit log stored in ~/.openclaw/skill-state/expansion-grant-guard/state.yaml.

Fields: active_grants, total_issued, total_expired, total_revoked, total_exhausted, total_tokens_granted, total_tokens_consumed, grant_history.

Notes

  • Uses Python's built-in modules only — no external dependencies
  • Grant IDs are timestamped and sequential within a day
  • Ledger file is append-friendly YAML — safe for concurrent reads
  • Expired grants kept in history for audit; active list stays clean after sweep
  • Default TTL is 30 minutes; max TTL is 24 hours
  • Token budget is advisory — enforcement depends on consuming skill cooperation

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Expansion Grant Guard AI skill do?

YAML-based delegation grant ledger — issues, validates, and tracks scoped permission grants for sub-agent expansions with token budgets and auto-expiry.

Why use Expansion Grant Guard on TypingMind?

Because you install it once and use it with any model. Expansion Grant Guard is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Expansion Grant Guard in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/ArchieIndian/openclaw-superpowers/tree/main/skills/openclaw-native/expansion-grant-guard. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Expansion Grant Guard?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Expansion Grant Guard?

As many as you like. As long as a model supports skills, you can use Expansion Grant Guard with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Expansion Grant Guard AI skill free?

It is published on GitHub by ArchieIndian. Check the repository for licensing terms. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇