FD 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.
As a process D 45/100 · Unfinished process — weak spots: result and completion, when it triggers, inputs and preconditions
What is at stake
The skill contains fragments that, in the wrong hands, cost money or data. Below: what the installer risks and what the author should do.
The files contain someone else's key or token. If it is live, your agent will call third-party services under a stranger's identity; if it was revoked, the skill's scripts simply fail. Such a key often arrives with the author's whole workspace, personal data included.
The key is visible to everyone who downloaded the skill and has likely been copied by catalog-scanning bots already. Revoke it now, check bills and access logs, then reissue.
How to improve
- Remove the critical guard findings (secrets, dangerous commands, hidden instructions): while they stand the skill is blocked and cannot grade above F.
- Your own cases (evals/evals.json, 4–6 real requests with expected answers): the full check would then run those instead of a model-drafted suite.
- A spec.yaml with trigger phrases and assertions — a behaviour contract for CI; `skilltest init` writes a template.
Guard findings · 14
-
critical Secrets in code
secret-openai-keyscripts/self_check.py:16OpenAI-style API key (quoted — discussed, not commanded)leaky = "api_key=sk-p…456 password: hunt…ret"
quoted
Medium and low: 13
-
medium Secrets in code
secret-private-keyscripts/context_guard.py:389Private key material (key header without key body; quoted — discussed, not commanded)-----BEGIN PRIVATE KEY----- …
header onlyquoted -
low Secrets in code
secret-openai-keyexamples/leaky_tool_dump.txt:3OpenAI-style API key (placeholder value)api_key = sk-p…000
placeholder -
low Secrets in code
secret-labelled-tokenexamples/leaky_tool_dump.txt:3Labelled token / key literal (vendor format unknown — verify it is not a live credential) (placeholder value)api_key = sk-p…000
placeholder -
low Secrets in code
secret-high-entropy-tokenexamples/leaky_tool_dump.txt:3High-entropy token-like string (may be an id, hash or a credential) (placeholder value)api_key = sk-p…000
placeholder -
low Secrets in code
secret-password-literalexamples/leaky_tool_dump.txt:3Hard-coded password / key literal (may be an example) (placeholder value)api_key = sk-p…000
placeholder -
low Secrets in code
secret-password-literalexamples/leaky_tool_dump.txt:5Hard-coded password / key literal (may be an example) (test fixture / example file)password: Supe…o99
fixture -
low Secrets in code
secret-openai-keyscripts/context_guard.py:387OpenAI-style API key (placeholder value)api_key = sk-p…000
placeholder -
low Secrets in code
secret-labelled-tokenscripts/context_guard.py:387Labelled token / key literal (vendor format unknown — verify it is not a live credential) (placeholder value)api_key = sk-p…000
placeholder -
low Secrets in code
secret-high-entropy-tokenscripts/context_guard.py:387High-entropy token-like string (may be an id, hash or a credential) (placeholder value)api_key = sk-p…000
placeholder -
low Secrets in code
secret-password-literalscripts/context_guard.py:387Hard-coded password / key literal (may be an example) (placeholder value)api_key = sk-p…000
placeholder -
low Secrets in code
secret-password-literalscripts/context_guard.py:388Hard-coded password / key literal (may be an example) (quoted — discussed, not commanded)password: hunt…ret
quoted -
low Secrets in code
secret-labelled-tokenscripts/self_check.py:16Labelled token / key literal (vendor format unknown — verify it is not a live credential) (quoted — discussed, not commanded)leaky = "api_key=sk-p…456 password: hunt…ret"
quoted -
low Secrets in code
secret-password-literalscripts/self_check.py:16Hard-coded password / key literal (may be an example) (quoted — discussed, not commanded)leaky = "api_key=sk-p…456 password: hunt…ret"
quoted
Files scanned: 9. Evidence is masked. Grey chips explain why severity was lowered.
Against the Agent Skills spec
✓ No remarks against the Agent Skills spec
Process rating: all ten parameters 45/100
- 0Result and completion. Does not say what the result is
- 0Inputs and preconditions. Does not say what the process needs to start
- 0Failures and branches. Linear process with no failure handling
- 20When it triggers. No condition that starts the skill
- 30Running it twice. 1 mutating operations with no state check
- 60Tools and files. Uses tools (bash) that frontmatter does not declare
- 100Steps. 5 steps
- 100Consistency. Name and required fields are in place
- 100Execution cost. Instruction body is 913 tokens
- 100Progress reporting. Reports progress
- medium Safety rules and hard prohibitions inside a skill: they belong in the system prompt, here they protect nothing
Everything here is measured from the skill text rather than judged by a model, so the numbers are checkable. A parameter weighs more when it is a more common reason for the process to stall.
Quality signals
- +5Description has no quoted example phrases that should trigger the skill
- +4Description does not say when NOT to use the skill (false activations)
- +3Output format is not stated: the model decides each time
- +2Single-language instructions
- +3Description length 476: enough signal without eating the budget
- +4Structure: 8 headings
- +3Step-by-step instructions: 5 items
- +4Has examples (3 code blocks)
- +4Reference files are cited in the instructions (1 of 1)
- +3All 2 scripts are documented
- +1License stated
Quality base 70; lint remarks subtract, signals add up to 100. Result: 92.