sage-doc

sage-doc is a command for Claude Code from gustavobarbosab/sage. It costs 0 tokens per session (475 once invoked), scanned A, original, MIT.

A prompt that creates a doc.md reference for a feature, covering its states, validation rules, edge cases, decisions, and explicit non-goals.

In plain words
What is it for?
Use it after a feature is specified and implemented to document how it behaves and why important design decisions were made.
Why use it?
It preserves the reasons behind feature behavior so the team can understand and maintain the code later, instead of relying on code alone or forgotten discussions.

Command for Claude Code

Written for Claude Code: a Claude Code command (commands/*.md).

Good fit Use it after a feature is specified and implemented to document how it behaves and why important design decisions were made.

Compare 6 commands from other repositories ↓
Install with agentmods
npx agentmods add commands/gustavobarbosab/sage/sage-doc
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/gustavobarbosab/sage

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for sage-doc

README.md
[![agentmods](https://agentmods.dev/badge/commands/gustavobarbosab/sage/sage-doc.svg)](https://agentmods.dev/commands/gustavobarbosab/sage/sage-doc)
Your own site
<a href="https://agentmods.dev/commands/gustavobarbosab/sage/sage-doc"><img src="https://agentmods.dev/badge/commands/gustavobarbosab/sage/sage-doc.svg" alt="Measured on agentmods" height="20"></a>
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 475 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00000 $0.00475
Opus 5 $0.00000 $0.00237
Sonnet 5 $0.00000 $0.00095
Haiku 4.5 $0.00000 $0.00047

Measured 6d ago against content hash 820925d2036b, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-07, from the pricing page.

Security

Grade A, and why

sage-doc scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 6d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

commands/sage-doc.md · 70 lines

How it starts

The opening of the file, as written. The whole thing — 70 lines — stays where its author put it; the contents beside it link to each section on GitHub.

/sage-doc

Use this prompt to generate doc.md — a behavioral reference document for the feature, with edge cases and decisions captured as embedded ADRs.

This is the documentation your team will read six months from now to understand not just what the feature does, but why it works the way it does.


Prompt

You are SAGE, a spec-first AI development assistant.

Read:
- The harness file (.sage/harness.md or in project knowledge)
- spec.md
- behavior.md
- The final generated code

Generate a doc.md with this structure:

## <FeatureName> — Behavior Reference

### Supported states
List every state the feature can be in, with a 1-line description of when it occurs.

### Validation rules
List every validation rule with the exact condition that triggers it.

### Edge cases
List every edge case explicitly documented in behavior.md, with the expected behavior.

### Decisions
For each open question that was resolved during the SAGE workflow, document:
- The decision that was made
- The reasoning behind it (the WHY, not just the WHAT)
This is the ADR-style record embedded in the feature documentation.

### Out of scope
List explicit non-goals from spec.md — what this feature deliberately does NOT handle.

### Known limitations
Anything the implementation can't currently do, even if it should eventually.

---

Be concise. Each item should be 1-2 lines. The goal is a document a teammate can scan in 60 seconds and understand the feature's behavior contract.

Where to publish

Once you have doc.md, you can:

  • Commit it alongside the code in your repo
  • Publish to Confluence via the Atlassian MCP
  • Publish to Notion via the Notion MCP
  • Drop it into an Obsidian vault (it's already in Markdown)
  • Add it to a GitBook space via the GitBook integration
  • Wiki page on GitHub via gh api

Tips

  • The "Decisions" section is the most valuable part long-term — it captures the reasoning that would otherwise be lost
  • Keep it focused on behavior, not implementation details (those live in code comments)
  • If a section would be empty (e.g. no edge cases), omit it rather than padding

Read the full file on GitHub · 70 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 6d ago First seen · 70 lines · 0 tokens per session scan A 820925d2036b

Subscribe to this mod's changes

sage-doc is a command published in the GitHub repository gustavobarbosab/sage (2 stars, last pushed 2mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 475 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.