Skip to main content
Glama

Server Configuration

Describes the environment variables required to run the server.

NameRequiredDescriptionDefault
PC_USER_DIRNoOverrides the personal-layer directory (default $XDG_CONFIG_HOME/protect-context or ~/.config/protect-context)
PC_SESSION_IDNoNames the session used for evidence and loop views, so parallel hosts do not share a view

Instructions

Guidance the server publishes about itself, which clients place ahead of the tool catalog so the model reads it before choosing anything.

This server publishes no instructions, or was last inspected before Glama recorded them.

Capabilities

Features and capabilities supported by this server

Protocol revision2025-11-25

CapabilityDetails
tools
{
  "listChanged": true
}
logging
{}
prompts
{
  "listChanged": false
}
resources
{
  "subscribe": false,
  "listChanged": false
}
extensions
{
  "io.modelcontextprotocol/ui": {}
}
experimental
{}

Tools

Functions exposed to the LLM to take actions

NameDescription
guard_statusA

Session dashboard: diff, loops, evidence, contract size, and the last verify.

Use it at the start of a turn, after a compaction, or before claiming the work is done, when you need the current guardrail state in one block. It takes no parameters. It returns text beginning with PC status: the session name (PC_SESSION_ID, or default), git head, diff stats and verdict, up to three loop streaks, the evidence count and last run, the merged constraint count, discovered conventions files, and a final Nudge line. Side effects: if .agent-guard/ is missing it is created, config.json is seeded with the frozen defaults when that file is absent, and the first contract read writes the twelve seed constraints to contract.json. It also runs git for the diff. It does not append the journal or the evidence ledger.

guard_verifyA

Run a shell command and record the outcome as evidence.

Use it before claiming a check passed, and cite the returned evidence id. Do not use it to retry a command that guard_loop_check already says will be blocked. command is a required string and runs verbatim (shell=True) with the caller's privileges; stdin is closed. timeout_s is an int, default 180, clamped to 1–900. It returns a text report: on a real run, PC verify ev-NNNN · exit N · ok|FAIL|UNTRUSTED · <ms>ms, plus cwd, the command, a digest or failure tail, and a Nudge. Exit 0 from a pipeline (no pipefail) or a failure mask such as || true is labelled UNTRUSTED and is not proof. A blocked loop returns PC verify blocked and does not add a ledger row. Nonzero exits are recorded, not raised. Side effects: the command itself can change files, the network, or anything else the shell can do. A run that is not blocked appends one row to .agent-guard/verify_runs.jsonl and creates the store if needed. The loop-brake check can also seed config.json.

guard_evidenceA

Read recorded verification runs.

Use it to recover a past evidence id, its exit code, and the stored digest instead of re-running the command. limit is an int, default 5, clamped to 0–20, and applies only when evidence_id is omitted. evidence_id is an optional string, default None. With an id, it returns the full single-run report (the same shape as guard_verify, including why/fix for FAIL and UNTRUSTED). Without an id, it returns PC evidence · last N of TOTAL, one line per run, the last digest line of any non-ok row, and a Nudge. Side effects: none. It does not create .agent-guard/ and does not execute commands.

guard_contractA

List, add, or remove a project contract constraint.

Use list before acting on rules you might have forgotten, add when the owner states a durable constraint this session should keep, and remove only for a constraint this agent added. action is a required string: list, add, or remove. text is an optional string, required for add. id is an optional string, required for remove. list returns the merged contract (project plus personal layer) and a Nudge. add returns the new id and the rendered contract, or a duplicate notice. remove returns the rendered contract, or a refusal. Side effects: list creates .agent-guard/ and, when contract.json is missing, writes the twelve seed constraints. add and remove rewrite the project contract.json only. This tool never writes the personal layer (--global / ~/.config/protect-context). Removing a seed constraint is refused; the owner removes those with the CLI or /guard-contract.

guard_noteA

Append one agent-authored journal entry.

Use it when a decision, correction, risk, or note should survive the session and the next compaction. Do not use it for a claim that a command passed; that belongs in guard_verify. type is a required string: decision, correction, risk, or note. text is a required string. tags is an optional list of strings, default None. The tag agent is always stored, so the entry stays unverified: it does not enter the trusted decisions or corrections the brief treats as owner input. Tag lesson to make a precedent the brief can re-inject. check is optional and applies to a correction only: it names the command that proves the rule still holds, which the brief runs (bounded, timed out) and labels. It returns logged <type> #N, the stored tags, any normalization notes, and a Nudge. Side effects: appends one JSON line to .agent-guard/journal.jsonl and creates the store if needed. It does not change the contract or the evidence ledger.

guard_journalA

Read recent journal entries back after a compaction or a capped brief.

Use it when the brief hid older decisions, corrections, risks, or the agent's own notes and you need the stored line, not a search. For a keyword, tag, or evidence-id search, use guard_recall instead. limit is an int, default 5, clamped to 0–20. type is an optional string, default None; when set it must be decision, correction, risk, or note. It returns PC journal · last N of TOTAL (or PC journal <type> when filtered), one line per entry (timestamp · type · text [tags]), and a Nudge. Side effects: none. It does not create .agent-guard/, does not append, and does not promote an agent tag to trusted.

guard_intentA

Owner wants, needs, preferences, and corrections from the journal.

Use it to answer "what does the owner want" without guessing keywords: every row whose text expresses an owner want, need, or preference, or an explicit "you are wrong" correction, plus rows already carrying the tags owner-want, owner-need, owner-preference, or owner-correction. Rows written before those tags existed are classified from their text, so nothing is lost. Each line is <kind> · <ts> · <text> [<provenance>], where provenance owner is a trusted row and agent is model-recorded and still unverified. limit is an int, default 5, clamped to 0–20. It returns PC intent · N of M owner statements, per-kind counts, and a Nudge. Side effects: none. It does not create .agent-guard/, does not append, and does not promote agent rows to trusted memory.

guard_briefA

The compact pre-agent brief, built from this project's store.

Use it when you need the same context the pi extension re-injects before a turn and no extension is running (another runtime, a script, a CI job, or a plain MCP client): the owner task, the contract with both additive budgets (owner rows, then seed rows), the newest owner statements, durable precedents, trusted decisions and corrections, unverified agent notes, tag- matched recall, open loops, and the last verify run with its trust label. Anything a cap dropped is announced with a +N more … line naming the read path, so the brief never silently omits context. Every line is rendered by the same functions the extension uses (protect_context.brief), so the two runtimes cannot drift. It returns the brief as one newline-separated string. limit is an int, default 20. Side effects: none — it does not create .agent-guard/, does not append, and does not change state.

guard_recallA

Search the retained journal and evidence window. No embeddings and no network.

Use it when you remember a word, tag, evidence id, or command but not which entry it was, including after the brief's caps hid it. Filters combine with AND. query is a string, default empty. type is an optional string (decision, correction, risk, note, or evidence), default None. tags is an optional list of strings, default None. limit is an int, default 5, clamped to 0–20. evidence_id and cmd are optional strings, default None. With a query, past bash commands from the retained events window are also eligible as reuse hints. It returns ranked lines labelled trusted or agent, then a Nudge. Rows rotated past the third ledger segment are already gone. Side effects: none. It does not create .agent-guard/ and does not write the journal or the evidence ledger. Agent hits stay unverified.

guard_loop_checkA

Report failing-command streaks for this session and whether the next rerun blocks.

Use it before repeating a command that just failed. The same normalized command, including a trailing ; or a trailing || true mask, shares one streak. It takes no parameters. It returns PC loops, up to five command × count lines, and a Nudge. When a streak is at loop_block_after (default 3), the text says the next identical run will be blocked. Streaks come from bash tool results and from guard_verify rows for PC_SESSION_ID (or default). An unproven exit 0 does not reset a streak. Side effects: if .agent-guard/ is missing it is created, and config.json is seeded when that file is absent. It does not run the command and does not append the journal or the evidence ledger.

guard_diff_auditA

Audit the working tree's size against the configured line and file thresholds.

Use it before a large edit, or when status shows a warn or hard diff, to see added/deleted lines, file count, and the verdict. baseline is an optional git ref string, default None (HEAD). Thresholds come from config: warn at 400 lines or 10 files, hard at 800 lines, unless the project or personal config overrides them. It returns the rendered diff audit, including a bounded-scan note when untracked reads hit their caps, and a Nudge. Outside a git repo the text says the diff is unavailable. Side effects: creates .agent-guard/ and seeds config.json if that file is missing, and runs git. Untracked content reads are capped (1000 files, 1 MB per file, 8 MB total). It does not modify the worktree or the ledgers.

guard_preflightA

Check configured tool presence and versions, and whether this directory is a git worktree.

Use it when a tool fails in a surprising way, before blaming the code. It takes no parameters. The tool list is preflight_tools from config (default git, python3, pip, node, npm, rg, pytest). At most 20 entries are probed; extras are counted as omitted. Each present tool is run as <tool> --version with a 2 second cap, a 15 second overall deadline, and at most 4 KiB of output. It returns PC preflight, git yes/no, present and missing tools, any incomplete version probes, and a Nudge. Side effects: creates .agent-guard/ and seeds config.json if needed, and executes those version probes. It does not install tools and does not append the journal or the evidence ledger.

guard_budgetA

Report this session's recorded tool-output size.

Use it when the context watermark is climbing or a turn is getting large, to see which tools produced the bytes. It takes no parameters. It reads events.jsonl for the current session (PC_SESSION_ID, or default) and returns PC budget, the character total, an estimate of tokens (integer division of characters by 4), the tool-result count, the top 5 tools by characters, and a Nudge. Side effects: none. It does not create .agent-guard/ and does not write events. A missing ledger is an empty budget.

guard_orientationA

Bounded repository digest: tree, languages, and conventions files.

Use it before the first edit in an unfamiliar checkout, so the next read starts from CLAUDE.md, AGENTS.md, CONVENTIONS.md, README.md, or README when those files exist. It takes no parameters. The scan starts at the git worktree root when one is found, otherwise the working directory. The tree is capped (12 entries, 8 children, depth 3, 4000 files). It returns PC orientation, the capped tree, up to six language counts by extension, the conventions files found, and a Nudge. Side effects: none. It only reads the filesystem. It does not create .agent-guard/ and does not use the network.

Prompts

Interactive templates invoked by user choice

NameDescription

No prompts

Resources

Contextual data attached and managed by the client

NameDescription

No resources

TDQS

A4.2/5.0

Scored across 14 tools

Disambiguation4/5

Most tools are clearly separated by resource and action (guard_note writes vs guard_journal reads, guard_verify records vs guard_evidence reads), and descriptions explicitly cross-reference alternatives (e.g. 'For a keyword search, use guard_recall instead'). The remaining friction is the cluster of journal-reading paths — guard_journal, guard_recall, guard_intent, and guard_brief all surface stored entries, and guard_recall's `type=evidence` overlaps with guard_evidence.

Naming Consistency5/5

Every tool uses the same `guard_` prefix plus a snake_case noun (guard_note, guard_status, guard_contract, guard_diff_audit, guard_loop_check). Multi-word names consistently use underscores and no mixed camelCase or verb-style outliers appear.

Tool Count4/5

14 tools sits at the top of the well-scoped band but each maps to a distinct guardrail concern: journaling, evidence, contract, status, loops, diff, preflight, budget, orientation. A few read-only introspection tools (guard_budget, guard_orientation) are narrower, but none appear redundant enough to cut.

Completeness4/5

Coverage is broad and balanced across write/read lifecycles: journal append+read+search+brief, verify+evidence lookup, and contract list/add/remove. Minor gaps exist — no way to clear a loop streak or reset state, no config/threshold setter, and journal entries cannot be edited or deleted (append-only by design).

Maintenance

ActivityNo data
ResponsivenessOutdated data