Skip to main content

Context Guardian

Keeps coding agents inside your application's map.

An agent edits src/checkout/pay.ts; Context Guardian finds that src/profile/settings.ts imports it and tells the agent which notes to read and which commands are safe to run.

Before an agent edits, Context Guardian tells it which features, invariants, and checks a task touches. When the agent finishes, it compares what changed against that map and reports what the agent missed: a feature that imports the code it changed, a platform twin it did not update, a business rule it should not have weakened.

It works with Claude Code, Gemini CLI, Codex, Cursor, GitHub Copilot, and other agents that read skills or AGENTS.md, and from a plain terminal with no agent at all. The engine is local, deterministic Python: no model calls, no network, no model tokens. Only its short reports reach the agent.

Status: alpha. Built for and used on React Native / Expo mobile applications. Imports and calls are resolved for TypeScript, JavaScript, and Python; Swift, Kotlin, Dart, Go, and other languages get lighter, pattern-based symbol extraction. Expect rough edges, and keep your tests: Context Guardian selects context and checks, it does not prove behaviour.

Quick start

You need uv and git. uv fetches a suitable Python (3.11+) if you do not have one.

# 1. The command (once per machine)
uv tool install context-guardian-cli
#    or straight from GitHub:
#    uv tool install git+https://github.com/CareoLimited/context-guardian

# 2. Let your agents find the skill (optional; shows a plan and asks first)
context-guardian install

# 3. Onboard an application (once per repository)
cd path/to/your-app
context-guardian bootstrap --project .

# 4. Check everything
context-guardian doctor

bootstrap detects your stack and feature folders, writes .app-context/, builds the map, and adds the integration files listed below. Review .app-context/profile.json and commit it with the rest.

What each agent gets

Agent Start and finish checks How
Claude Code Automatic Hooks in .claude/settings.json
Gemini CLI Automatic Hooks in .gemini/settings.json
Codex, Cursor, GitHub Copilot, others Agent runs them Instructions in AGENTS.md, plus the skill
No agent You run them context-guardian begin / finish, inspect, doctor

Every hook is one line that is identical on every machine, for example context-guardian hook --runtime claude-code --event Stop. Each teammate installs the command once; on a machine without it the hook prints a warning and the agent carries on unchecked. It never blocks anyone.

What a check looks like

An agent changes src/checkout/pay.ts. src/profile/settings.ts imports it, so at the end of the turn Context Guardian selects both features and their notes:

{
  "decision": "allow",
  "changed_files": ["src/checkout/pay.ts"],
  "selected_features": [
    { "id": "checkout", "matched_by": ["trigger", "impact"], "impact_hop": 1 },
    { "id": "profile",  "matched_by": ["impact"],            "impact_hop": 2 }
  ],
  "read": [".app-context/features/checkout.md", ".app-context/features/profile.md",
           ".app-context/invariants/product.md"],
  "validation_plan": [{ "command": "npm run typecheck", "safety": { "tier": "safe" } }]
}

(Shortened.) Errors send the agent back for another pass, a bounded number of times. Warnings are handed to you with the instruction to explain them and ask before changing anything.

Your application's .app-context/

.app-context/
  profile.json         features, path triggers, invariants, validation commands   (commit)
  features/*.md        what each feature is and must keep doing                   (commit)
  invariants/*.md      rules that apply to every change                           (commit)
  generated/           the code-derived map, refreshed automatically              (commit)
  runs/ findings.json watcher.json   per-turn state                               (ignored)

Curated files are yours; Context Guardian never rewrites them. The map is regenerated from the code.

Safety

  • Commands. Validation commands are classified as safe, requires-approval, or disallowed, segment by segment, the way a shell would run them. Agents may run only safe commands unasked. Publishing and pushing are always disallowed. context-guardian inspect-safety --command "<cmd>" shows the verdict.
  • Trust stays with you. A repository can ask to trust a project-specific check in commands.trusted; it takes effect only after you approve it on your machine with context-guardian trust --project . --command "<cmd>". Approvals are stored in your user configuration, never in a repository.
  • Writes stay in the project. Every file Context Guardian writes or deletes is checked first; nothing follows a symlink out of the repository.
  • No network, no telemetry. The engine reads your repository and runs git.

Commands

Command What it does
bootstrap / upgrade Onboard an application; bring an older setup up to date
begin / finish / abort Start and check a task (hooks do this for you)
preflight-intent --intent "<task>" Which features and notes a task description points to
inspect Context for the current diff
query-map / impact-map Bounded neighbourhoods of the code map
check-twins iOS / Android counterparts changed together, or intentionally not
inspect-safety, trust Command risk tiers; your own approvals
install / uninstall / doctor Agent setup on this machine; health check

Run context-guardian <command> --help for options. Most commands print compact JSON for agents; install, uninstall, and doctor print readable text (--json for agents).

Uninstall

context-guardian uninstall --project path/to/your-app   # removes hooks and blocks, keeps .app-context/
context-guardian uninstall                              # removes the agent skill links
uv tool uninstall context-guardian-cli

Development

git clone https://github.com/CareoLimited/context-guardian
cd context-guardian
python3 -m unittest discover -s tests

The design and its decision log are in docs/DESIGN.md. The engine uses only the Python standard library; please keep it that way.

License

MIT © 2026 Careo Limited

Metadata

Release files for context-guardian-cli 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for context-guardian-cli 0.1.0
File Size Uploaded Provenance Actions
context_guardian_cli-0.1.0.tar.gz 661.9 kB Without provenance Details for context_guardian_cli-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for context-guardian-cli 0.1.0
File Interpreter ABI Platform Actions
context_guardian_cli-0.1.0-py3-none-any.whl Python 3 none any Details for context_guardian_cli-0.1.0-py3-none-any.whl

Total release size: 746.3 kB

Release files / context_guardian_cli-0.1.0.tar.gz

Download URL context_guardian_cli-0.1.0.tar.gz
Size 661.9 kB
Tags Source
SHA-256 checksum
How to use checksums
6b66900fa8d6dfad5ff6fb4936054be55d263d83c0b0bc9cb889c1a32146aaa4
BLAKE2b-256 checksum
How to use checksums
ffa35fb5da2cf52fa6efdaf7bf0e822d830de51c366bc0434e16008fa255c65f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.1 {"installer":{"name":"uv","version":"0.13.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / context_guardian_cli-0.1.0-py3-none-any.whl

Download URL context_guardian_cli-0.1.0-py3-none-any.whl
Size 84.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9bacaa05df4ac4beefb08704c224d287843d451f2854b39f2383d5218d6149f6
BLAKE2b-256 checksum
How to use checksums
6b3621c0b77f2f1da4ae24fe46258bf705f6a88a7063d4143fa9e04734746d65
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.1 {"installer":{"name":"uv","version":"0.13.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for context-guardian-cli 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page