It reads the rules first.
The pipeline makes knowledge lookup mandatory instead of hoping an agent happens to open the right doc.
Sage gives every coding agent four questions before it touches your repo: is this needed, will it last, is it safe, and did the team agree? Then it reads your rules, reuses what exists, names the risk, and stops when the change is unsafe.
bash -c "$(curl -fsSL https://cdn.jsdelivr.net/gh/qorstack/sage@latest/install.sh)"
Bash — macOS, Linux, or Windows git-bash/WSL · PowerShell — Windows · asks which AI tools to wire up · re-run any time to update
Role: backend — user-settings Risk: HIGH - irreversible data loss, touches auth and billing records. Decision: ask Matched rules: "Never hard-delete users — use soft_delete() with 30-day grace." "All destructive actions must write to audit_log before executing." I found users/soft_delete.py and users/audit_log.py. Because this is high risk, I will wait for confirmation before editing code.
Most agents can edit files. The hard part is knowing which decisions the team already made, which helpers exist, and which changes should pause before touching production paths.
The pipeline makes knowledge lookup mandatory instead of hoping an agent happens to open the right doc.
Services, helpers, components, conventions, and decisions are surfaced before new code is invented.
Block rules reject unsafe output. Ask rules stop and wait for a human before high-risk code lands.
Sage is not another coding agent. It is the cognition layer your existing agents read before they act.
It asks which AI tools you use (multi-select), fetches the protocol and commands, and wires up the ones you pick. Re-run any time to update. Your own knowledge is never overwritten.
bash -c "$(curl -fsSL https://cdn.jsdelivr.net/gh/qorstack/sage@latest/install.sh)"
irm https://cdn.jsdelivr.net/gh/qorstack/sage@latest/install.ps1 | iex
Pick from Claude Code, Codex, Cursor, Copilot, Gemini,
Windsurf, Cline — the installer wires up the ones you choose.
Run /sage-learning once to capture your team's
real patterns — then just use /sage.
/sage-learning # scan the repo, write team knowledge to agents/sage/
Each command builds on the last — learn first, then code with full context, then document for your team.
Learns your codebase's real patterns (rules + decisions) and researches current best practices for your stack (skills) — one run. Gives Sage a knowledge baseline before it touches anything.
Full pipeline before and after every code change — pick role,
read team knowledge, assess risk, code, capture, summarize. It
also shows a short checklist. Auto mode selects the recommended
set and continues; ask mode uses the best picker the host
exposes. Then it runs the right specialist itself:
/sage-flow,
/sage-unit-test, /sage-e2e-test,
/sage-security-review. You mostly just type
/sage.
Turn any spec, README, or meeting note into a plain-Markdown
flow doc in docs/ — end-to-end ASCII diagram, full
step-by-step, complete API spec, open questions. Reads on
GitHub, diffs in a PR — no HTML, CSS, or JS. Use when a teammate
needs to read — not when an AI needs to follow.
Before each change, /sage shows a short checklist.
Auto mode continues without prompting; ask mode prefers native
checkboxes, then structured or compact fallbacks. Sage runs the
right specialist itself: design the flow
(/sage-flow), write tests
(/sage-unit-test, /sage-e2e-test), review
security (/sage-security-review), refresh docs
(/sage-docs), and continues across handoffs until a
material gate or completion.
Role : debugger — fix infinite API loop
Model : sonnet 4.6 @ effort:medium
Intent : stop useCallback recreating every render
Touches : BoqUsagePlanSection.tsx
Risk : LOW — dep array fix only
Decision: proceed
... [fix applied] ...
── Sage ────────────────────────────────
Role : debugger — fix infinite loop
Model : sonnet 4.6 @ effort:medium
Domain : frontend | Risk: LOW
Root cause: useLoadingScreen() returns a
new object on every render.
Adding it to useCallback deps
triggers refetch on each render.
Mechanism : render → new ref → callback
recreated → useEffect fires →
API called → setState → repeat
Fix : removed unstable refs from
deps, kept only [materialId]
Validated : network tab: 1 call on load,
0 repeated calls
Slipped : hook API looks stable but
returns {} without useMemo
Knowledge : [new] decisions/
usecallback-unstable-deps.md
────────────────────────────────────────
/sage-learning
── Sage Learning ───────────────────────
Stack : TypeScript, Next.js 15,
React 19, MUI, Valibot
Domains : frontend, api, auth, billing
From code :
[new] frontend/rules.md
[new] decisions/
usecallback-unstable-deps.md
[updated] roles/role-frontend.md
Research :
[new] frontend/skills/
server-component-boundaries.md
Next : flip status: approved on
entries you want enforced
────────────────────────────────────────
/sage-docs [paste spec or describe doc]
Language · English
Doc type · api-flow
Output · docs/checkout-flow.md
Systems · Website, Service, Gateway
Sections
- Actors & Systems
- End-to-end overview (ASCII flow)
- Step-by-step + full API spec
- Edge cases · Security
- Open Questions
Coverage · 7 steps · 8 endpoints
6 errors — all covered
Plain Markdown — reads on GitHub,
diffs in a PR. No HTML/CSS/JS.
Sage stores decisions in your repo, not in a hidden chat memory. Humans review the Markdown. Git shares it with every teammate and every future agent.
--- title: Use idempotency keys domain: payment status: approved enforcement: block --- All payment calls MUST pass an idempotency key. Reuse payments/idempotency.py; never roll your own.
AI can propose knowledge, but approved decisions are plain files your team can review, diff, and change.
Claude Code, Cursor, Codex, Copilot, and other agents can read the same protocol and the same rules.
Block rules refuse unsafe output. Warn rules proceed with caveats. Ask rules stop for confirmation.
No server. No build. No runtime. Just a protocol, a folder of Markdown commands, and your team's knowledge — one command sets it up and makes cognition part of the coding workflow.