agentleFS
mahumadadmahumadad/quarry/skills/ai-security/sysprompt-analysis/SKILL.md

sysprompt-analysis

Skill0 starsChanged 18 days agoMITView on GitHub

Produce the safeguard-analysis document that the AI red-team workflow and engine/ai_red_team.py SafeguardProfile.load_from_analysis() consume: parse a target AI agent's own policy / system prompt into its action categories, injection surfaces, permission gates, exceptions and delegation model. Keywords: system prompt analysis, safeguard profile, policy parsing, AI agent policy, permission gates, injection surfaces, analysis.md. Run this in the AI red-team "analysis" phase BEFORE template setup; it is the artifact the bridge turns into a SafeguardProfile. Do NOT use to craft payloads (see prompt-injection) — this only maps the target's declared safeguards.

The file

We split this skill into the rules it gives an agent

1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    If parse_warnings is non-empty, the document is missing a section the parser expected — fix the headings rather than shipping an empty …

    line 98

≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

sysprompt-analysis — map a target agent's declared safeguards

The AI red-team workflow (workflows/ai-red-team.yaml, phase analysis) depends on an analysis document that nothing else produces. This skill is that producer. engine/ai_red_team.py → SafeguardProfile.load_from_analysis() parses the markdown this skill writes; RedTeamBridge then uses it to drive template selection (_rank_by_profile) and the red-team preamble.

When to run

  • In the analysis phase of an AI red-team engagement, after scope is confirmed and before ai-red-team-bridge sets up templates.
  • Input: the target agent's own text — its system prompt, policy card, tool descriptions, developer docs — WHATEVER you are authorized to inspect. Only record what the source actually says; an unrecognized document must yield an empty section, never an invented safeguard (the extractors already warn on empty sections, and anti-fabrication applies to analysis too).

Output: write analysis.md in exactly this shape

The extractors key off these headings and list formats, so match them:

Source: <target name>
model: <model id or "unknown">

### Action categories

#### Prohibited
- <action the agent states it will never do>
- <...>

#### Explicit permission
- <action requiring explicit user confirmation>

#### Regular
- <action the agent performs without confirmation>

### Injection surfaces
- tool result (high risk, defense: ISB)
- retrieved document content (medium risk)
- <attacker-controlled channel the agent ingests> (<low|medium|high> risk, defense: <control>)

### Permission gates
- send_email — gated (explicit) via confirm_tool
- file_write — ungated
- shell — requires confirmation (operator)

### Exceptions
- local-dev test values — when: host is localhost — effect: allows test credentials
- <exception name> — when: <condition> — effect: <what it relaxes>

### Delegation model
- subagents: <yes/no, and whether they inherit the parent's permissions>
- parallel: <fork/fan-out behavior>

Notes that make the parse clean:

  • The Source: and model: lines must be within the first 30 lines (key: value form).
  • Each ### Injection surfaces / ### Permission gates / ### Exceptions section is a flat bullet list; a non-list line ends the section.
  • Permission gates: channel — gated|ungated|requires confirmation (type) via Tool, or a | channel | gated | gate_type | tool | table. "ungated" is the signal the bridge keys the preamble on (ungated_channels()), so get those right.

Hand-off

Save the document as analysis.md in the engagement, then point the bridge at it:

python3 - <<'PY'
from engine.ai_red_team import SafeguardProfile
p = SafeguardProfile.load_from_analysis("analysis.md")
p.save(".pentest-state/safeguard_profile.json")
print("ungated:", p.ungated_channels())
print("warnings:", p.parse_warnings)
PY

If parse_warnings is non-empty, the document is missing a section the parser expected — fix the headings rather than shipping an empty profile. The bridge loads this profile with load_profile(...) and uses it to prioritize the templates that test the channels the target itself left ungated.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.