安全

LYGO Context Guard

试用

LYGO Context Guard — pre-flight token budget, secret redaction, and deterministic context compaction for AI agents. Use when stuffing tool dumps, logs, files, or long chats into a model; when context is too large; when you need to save tokens / reduce API cost; when you must redact API keys before re-injection. Pure local stdlib. No network, no subprocess. Commands: estimate, redact, compact, budget, toolpack, preflight. Install clawhub:@deepseekoracle/lygo-context-guard.

它能做什么

LYGO Context Guard — pre-flight token budget, secret redaction, and deterministic context compaction for AI agents. Use when stuffing tool dumps, logs, files, or long chats into a model; when context is too large; when you need to save tokens / reduce API cost; when you must redact API keys before re-injection. Pure local stdlib. No network, no subprocess. Commands: estimate, redact, compact, budget, toolpack, preflight. Install clawhub:@deepseekoracle/lygo-context-guard.

技能文档

LYGO Context Guard v1.0.0

The pre-flight every agent needs.

OpenClaw burns money when tool dumps and chat history explode the context window.
Context Guard is a local lattice gate: estimate tokens → redact secrets → compact deterministically → check budget — before you call the model.

Signature: Delta9Phi963-CONTEXT-GUARD-v1.0.0
ClawHub: @deepseekoracle/lygo-context-guard


Why this exists

ProblemWhat agents do wrongGuard does
Token burnRe-inject full logs/tool JSON every turnCompact + budget exit code
Secret leaksAPI keys in tool output → model contextRedact patterns
Context overflow“Just paste the whole file”Head/tail + mid map + SHA
No visibilityGuessing token countsDual heuristic estimate

Searches this skill targets: token saver, context window, compress context, reduce tokens, prompt budget, redact secrets, tool result too large.


Install

npx clawhub@latest install deepseekoracle/lygo-context-guard

Commands

cd path/to/lygo-context-guard
python scripts/self_check.py

# Estimate tokens (heuristic)
python scripts/context_guard.py estimate --text "long tool dump..."
python scripts/context_guard.py estimate --file ./huge_log.txt

# Redact secrets (keys, JWTs, private key blocks, password=...)
python scripts/context_guard.py redact --file ./tool_out.txt

# Deterministic compact (dedupe lines + head/tail keep)
python scripts/context_guard.py compact --file ./tool_out.txt --max-chars 8000

# Budget gate (exit 10 if over)
python scripts/context_guard.py budget --file ./pack.txt --budget 4000

# One-shot for agents: redact + compact + budget
python scripts/context_guard.py toolpack --file ./tool_out.txt --budget 4000 --max-chars 8000

# Full preflight report
python scripts/context_guard.py preflight --file ./blob.txt --budget 8000
python scripts/context_guard.py preflight --file ./blob.txt --write last_preflight.json --i-consent

# Demo (synthetic leaky dump)
python scripts/context_guard.py demo
CommandNetworkWritesNotes
estimate / redact / compact / budget / toolpacknonenostdout JSON + text
preflight --writenoneskill state/ onlyneeds --i-consent
demononenobuilt-in sample

Agent recipe (copy this)

Before re-injecting a large tool result or log:

1. Save tool output to a temp file
2. python scripts/context_guard.py toolpack --file THAT_FILE --budget 4000
3. If exit code 10 → lower max-chars or split the task
4. Feed packed_text back into the model — not the raw dump

Exit codes:

CodeMeaning
0OK / under budget
10Over budget after pack
2Missing file / bad input

What it does not do

  • No network / shell / subprocess
  • No cloud summarizer (deterministic only — reproducible)
  • No auto model calls
  • Does not claim exact tokenizer parity (honest heuristic; good for budgets)
  • Never stores secrets in reports when writing preflight (stores hash of packed text)

Pair with

SkillRole
lygo-api-token-saverBroader pay-to-go budget ops + local army preference
lygo-pxpipe-lygoVision / multi-tool dump compression
lygo-ops-detectorDiscourse signal analysis (different problem)
lygo-kickstart-wizardOnboarding map

Security

See references/SECURITY.md.
Δ9Φ963 — compress chaos · redact secrets · budget the lattice · human remains the publisher.

相关技能

LYGO CLI Bridge — unified entrypoint: lygo health | map | analyze | mint | radar | next. Wraps kickstart + ops-detector + mint-walkthrough + deception-radar without exposing internal skill layout. In-process imports only; no subprocess; no auto-publish. Install clawhub:@deepseekoracle/lygo-cli-bridge.

1 次安装

Multi-tool vision context compression for LYGO (Anthropic, OpenAI, Grok/xAI, Gemini). Use before stuffing huge prompts or logs into pay-to-go APIs. Requires...

1 次安装

LYGO Continuum — falsifiable work capsules for AI agents and humans. Seal 'done' as checkable claims (file SHA-256, contains, JSON paths, globs under --base), re-verify, drift, handoff. CLI: pure local stdlib — no network, no subprocess. Paths/globs confined under --base; --out under base or state/ with --i-consent. Optional separate browser portal is NOT opened by the skill. Commands: seal, verify, drift, handoff, card, demo. Install clawhub:@deepseekoracle/lygo-continuum.

1 次安装

Minimize pay-to-go xAI/API token spend. Use when user says token saver, save tokens, API budget, pay-to-go burn, or before long Grok/Claude/GPT calls. Prefer...

1 次安装

LYGO Deception Radar — public proof layer for Ops Detector. Rebuilds an anonymized radar feed + HTML dashboard from the public labeled discourse suite only. Shows strong vs weak vs clear bands with operational threshold 0.65. Not for doxing or private mail. No subprocess. Install clawhub:@deepseekoracle/lygo-deception-radar.

1 次安装

OpenClaw plugin skill — live Haven pulse, stack verify, registry compare, star chart gate, alignment readiness. Install clawhub:@deepseekoracle/lygo-lattice-pulse.

1 次安装