Architecture, installation, and reference for integrating Sentinel into any AI coding agent.
skills/
CONSTITUTION.md # Shared rules (referenced by all adapters)
GENERIC.md # Universal skill for any agent
adapters/
claude/CLAUDE.md
gemini/GEMINI.md
codex/CODEX.md
cursor/sentinel.mdc
cline/CLINE.md
opencode/SKILL.md
windsurf/.windsurfrules
roo/ROO.md
src/
mcp/
server.ts # MCP server (standalone, no external dependency)
cli/
install-skills.ts # sentinel-cli install-skills command
install-skills.sh # Bootstrap for Unix
install-skills.ps1 # Bootstrap for Windows
Each adapter contains the same core content (constitution rules, command reference, workflows, evidence policy) formatted for the target agent platform. Only the file format and syntax differ.
sentinel-cli install-skills # Interactive: select agent
sentinel-cli install-skills --agent claude
sentinel-cli install-skills --agent all # Install for all detected agents
sentinel-cli install-skills --list # List supported agents
sentinel-cli install-skills --detect # Auto-detect installed agents# Unix
bash install-skills.sh
# Windows
powershell -File install-skills.ps1The standalone script is a fallback for environments where the full Sentinel CLI is not available.
install-skills --detect checks for these binaries in PATH:
claude(Claude Code)gemini(Gemini CLI)codex(OpenAI Codex CLI)cursor(Cursor)cline(Cline)opencode(OpenCode)windsurf(Windsurf)roo(Roo Code)
It also checks for configuration directories like ~/.cursor/rules/, ~/.config/opencode/, and project-local .claude/ directories.
| Agent | File | Location |
|---|---|---|
| Claude Code | CLAUD.md |
Project root or .claude/CLAUDE.md |
| Gemini CLI | GEMINI.md |
Project root |
| OpenAI Codex | CODEX.md |
.reference/CODEX.md |
| Cursor | sentinel.mdc |
.cursor/rules/sentinel.mdc |
| Cline | CLINE.md |
Project root |
| OpenCode | SKILL.md |
.opencode/skills/SKILL.md |
| Windsurf | .windsurfrules |
Project root |
| Roo Code | ROO.md |
Project root |
| Any MCP client | MCP protocol | Connects to sentinel-cli mcp (stdio or HTTP) |
Sentinel exposes its full tool set through the Model Context Protocol (MCP). Any MCP-compatible agent (Claude Desktop, Cursor, Cline, OpenCode) can connect directly without needing a static skill file.
# Start MCP server (stdio mode)
sentinel-cli mcp
# Start MCP server (HTTP mode)
sentinel-cli mcp --http --port 3003The MCP server exposes the same tools available in the CLI:
scan— SAST scan with 30 rulesverify-pkg— npm package audit (zero-install)doctor— system health checkintegrity— host integrity verificationcheck-classified— classified file checkmemory— signal vault querythreat-query— threat intelligence lookup by authorthreat-correlate— correlate findings with threat databasegh-pr-list,gh-pr-view,gh-pr-diff,gh-repo-list— GitHub PR toolsinstall-pkg,remove-pkg— package management tools
Sentinel commands cost zero model tokens. Every analysis task delegated to Sentinel preserves tokens for work that requires model reasoning. The token savings are substantial:
| Command | Tokens Saved | Model Alternative |
|---|---|---|
sentinel-cli scan <file> |
~2,000 | Model reads file + reasons about security patterns |
sentinel-cli scan <dir> |
~8,000+ | Model walks directory + reads every file |
sentinel-cli verify-pkg <pkg> |
~10,000+ | Model cannot audit tarballs; best effort is guessing |
sentinel-cli doctor [--deep] |
~5,000 | Model parses lockfile + evaluates each dependency |
sentinel-cli integrity |
~1,500 | Model checks PATH + reads config files |
sentinel-cli permissions <pkg> |
~3,000 | Model reads package source + classifies capabilities |
sentinel-cli memory --threats |
~2,000 | Model has no access to local threat history |
sentinel-cli check-classified <path> |
~1,000 | Model reads staged files + compares to rules |
sentinel-cli baseline diff |
~4,000 | Model reads both snapshots + computes diff |
gh-pr-diff + scan (full PR audit) |
~10,000+ | Model reads entire PR diff + analyzes each hunk |
| Workflow | Tokens Saved | Notes |
|---|---|---|
| PR Security Review | ~15,000 | gh-pr-diff + scan + memory + gh-pr-comment |
| Package Audit | ~12,000 | verify-pkg + memory correlation |
| Host Integrity | ~8,000 | integrity + doctor + baseline |
| Full Repo Audit | ~50,000+ | Scales with number of PRs |
At typical AI coding agent pricing:
- Claude Code: ~$0.50 saved per full repo audit
- Cursor: ~$0.30 saved per PR review
- OpenCode: ~$0.20 saved per package audit
More importantly, tokens are a context window budget. Using Sentinel for deterministic analysis leaves the model's context window free for:
- Understanding the business logic of findings
- Generating remediation code
- Explaining attack chains in human terms
- Handling novel security patterns not covered by static rules
If a question can be answered by running a shell command, the agent should prefer the command over model reasoning. This is the core of the token economy: local execution is free; inference is expensive.
Evidence is ranked by four tiers. Higher tiers override lower tiers. See docs/TRUST_MODEL.md for full details.
- Sentinel Evidence — deterministic tool output (highest)
- Local System State — observable facts from the environment
- GitHub Metadata — externally sourced repository data
- Model Reasoning — AI model inference (lowest)
The agent must never use model reasoning to override Sentinel evidence. If Sentinel says BLOCK, the agent must report BLOCK.
1. gh-pr-diff (number) → get raw diff
2. scan (path: <diff>) → analyse for threats
3. memory (action: --threats) → correlate with historical threats
4. gh-pr-comment (number, body) → post structured report
1. verify-pkg (package) → analyse tarball
2. memory (action: --threats) → check author history
3. Report ALLOW/BLOCK/REVIEW → decision with evidence
1. integrity → verify host
2. doctor (deep: --deep) → dependency health
3. baseline (action: diff) → compare with known snapshot
1. check-classified (path) → verify staged files
2. classify (file) → check specific file
1. gh-repo-list (owner) → list repositories
2. gh-pr-list (repo) → list open PRs
3. gh-pr-diff (number) → get diff for each PR
4. scan (path) → analyse each diff
5. gh-pr-comment (number, body) → post findings
| Command | Description |
|---|---|
sentinel-cli scan <path> |
SAST scan with 30 rules. Detects secrets, eval(), env access, network requests, command injection, SQL injection, prototype pollution, crypto misuse, and more. |
sentinel-cli scan <path> --json |
Machine-readable JSON output. |
sentinel-cli verify-pkg <package> |
Audit npm package without installing. Detects typosquatting, secret leaks, malicious patterns. |
sentinel-cli verify-pkg <package> --details |
Full analysis breakdown. |
sentinel-cli doctor [--deep] |
System health check for npm dependencies. Deep flag analyses full dependency tree. |
sentinel-cli integrity [--uptime] [--watch] |
Host integrity verification. Checks code hash, PATH, vault, clock, manifest. |
sentinel-cli baseline create <name> |
Create system snapshot. |
sentinel-cli baseline diff [name] |
Compare current state against snapshot. |
sentinel-cli permissions [package] |
Audit package capabilities and governance. |
| Command | Description |
|---|---|
sentinel-cli check-classified <repoPath> |
Pre-commit hook. Blocks if classified files staged. |
sentinel-cli classify |
Manage classified document database. |
| Command | Description |
|---|---|
sentinel-cli install <manager> [args...] |
Install packages through security gate (npm, pip, yarn, etc.). |
sentinel-cli guard enable |
Enable OS-level package interception. |
sentinel-cli guard disable |
Disable interception. |
sentinel-cli guard status |
Show guard state. |
| Command | Description |
|---|---|
sentinel-cli memory --status |
Signal vault status summary. |
sentinel-cli memory --findings |
List historical findings. |
sentinel-cli memory --threats |
Show threat correlations. |
sentinel-cli memory --ingest <file> |
Load findings into vault. |
sentinel-cli memory --wipe |
Clear vault data. |
| Command | Description |
|---|---|
gh pr list [--repo owner/repo] |
List open PRs. |
gh pr view <number> [--repo owner/repo] |
View PR details. |
gh pr diff <number> [--repo owner/repo] |
Get PR diff. |
gh pr comment <number> --body-file <file> |
Post comment on PR. |
gh repo list [--owner user] [--limit N] |
List repositories. |
| Command | Description |
|---|---|
sentinel-cli env-encrypt <file> |
Encrypt .env file (AES-256-CBC). Requires SENTINEL_ENV_KEY. |
sentinel-cli env-decrypt <file> |
Decrypt .env.enc file. |
sentinel-cli hub |
Interactive TUI. |
sentinel-cli policies |
Show security policy. |
sentinel-cli guide |
Complete user guide. |
Complete pipeline: list PRs in a repo, fetch each diff, scan with SAST, correlate with threat database, and post structured report as a PR comment.
Steps:
gh-pr-list --repo <name> --limit <N>— get open PRs- For each PR:
gh-pr-diff --repo <name> --number <N>— get diff scanon each diff — detect threatsmemory --threats— correlate author with historical threatsgh-pr-comment— post finding report
Output: structured security report per PR with severity, location, evidence snippet, and recommendation.
Token cost: 0 (all analysis is local).
Zero-install package audit with author threat correlation.
Steps:
verify-pkg --package <name>— analyse tarballgh-pr-listor direct query for author context (if available)- Cross-reference findings with threat database
Output: ALLOW / BLOCK / REVIEW verdict with evidence.
Token cost: 0.
Host and environment security verification.
Steps:
integrity— check code hash, PATH, vault, clockdoctor --deep— dependency vulnerability analysisbaseline diff— detect drift from known-good state
Output: integrity level (TRUSTED / WARNING / COMPROMISED) with issue list.
Token cost: 0.
Prevent classified data leakage through git.
Steps:
check-classified --path <repo>— verify staged files- If blocked:
classifyto inspect specific file
Output: pass/fail with matched file list.
Token cost: 0.
Complete multi-repository security audit.
Steps:
gh-repo-list --owner <name>— list repos- For each repo:
gh-pr-list— get open PRs - For each PR:
gh-pr-diff+scan— analyse gh-pr-comment— report per PR
Output: summary across all repositories with per-PR findings.
Token cost: 0 (all analysis is local; only final report generation uses the model).
Every security conclusion MUST include ALL 5 fields for EACH finding individually — no summaries, no tables, no grouping:
=====================================================================
REPO: <repo> | PR #<N> | VEREDICTO: <BLOCK|REVIEW|PASS> [<band>]
ACCION: DO NOT MERGE | REQUIRES HUMAN REVIEW | SAFE TO PROCEED
=====================================================================
>>> HALLAZGO: <severity> | <type>
ARCHIVO: <file>:<line>
QUE ENCONTRO SENTINEL: <description>
RIESGO: <risk explanation>
EVIDENCIA LITERAL:
<verbatim snippet>
The agent MUST NOT: group by severity, present summary tables, omit any field, say "see above," or paraphrase away evidence. The verdict IS the action. For BLOCK, do NOT suggest fixes — rejection means rejection.
Place CLAUD.md in your project root. Claude Code reads it automatically on project context load. The skill teaches Claude:
- When to call
sentinel-cli scaninstead of reading files - How to interpret BLOCK / REVIEW / ALLOW
- To attach evidence verbatim to every security claim
- To chain tools for complete workflows
Other agents follow the same pattern with their respective skill file name and location.