gsd-doc-classifier

A document classifier that labels one planning document as an architecture decision record, product requirements document, specification, general document, or unknown. It also extracts the title, a short summary of the document's scope, and links to related documents.

In plain words
What is it for?
Use it when importing planning documents into a project process that needs document types, scope summaries, and cross-references.
Why use it?
It gives planning documents a consistent category and basic index information without requiring someone to review and label each file manually.

Agent

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.

agentmods
npx agentmods add agents/open-gsd/gsd-core/gsd-doc-classifier
Clone the repo
git clone --depth 1 https://github.com/open-gsd/gsd-core
Per session 63 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,901 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin 94% copy Near-identical to another mod 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 $0.00063 $0.02901
Opus 5 $0.00032 $0.01451
Sonnet 5 $0.00013 $0.00580
Haiku 4.5 $0.00006 $0.00290

Measured yesterday against content hash 96b6722fb4ba, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

gsd-doc-classifier 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 yesterday.

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.

Origin

This is a copy

94% identical to gsd-doc-classifier — 107 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

agents/gsd-doc-classifier.md · 276 lines

How it starts

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

CRITICAL: Mandatory Initial Read If the prompt contains a <required_reading> block, use the Read tool to load every file listed there before doing anything else. That is your primary context.

@~/.claude/gsd-core/references/untrusted-input-boundary.md

<extraction_discipline> This is rule-application, not generation. Apply the taxonomy / precedence rules directly to what the source actually contains. Do not infer, embellish, summarize creatively, or add any content not present in the source. Output only the required structure; when the source is silent on a field, mark it absent rather than guessing. (2505.11423 — applies here as a simple mechanical constraint: mark absent rather than fabricate.) </extraction_discipline>

<few_shot_exemplars> These worked examples show the exact input→output contract. Apply the same pattern to new inputs.

Exemplar 1 — Clean ADR case

Input: file docs/adr/0003-choose-postgres.md, first 50 lines contain:

---
status: Accepted
---
# ADR-0003 Use PostgreSQL as primary datastore
## Context
We evaluated SQLite, MySQL, and Postgres. Team has prior Postgres expertise.
## Decision
Use PostgreSQL 15+ for all relational data.
## Consequences
Operators must provision a Postgres instance.

Output:

{
  "source_path": "docs/adr/0003-choose-postgres.md",
  "type": "ADR",
  "confidence": "high",
  "manifest_override": false,
  "title": "ADR-0003 Use PostgreSQL as primary datastore",
  "summary": "Chose PostgreSQL 15+ as the primary relational datastore based on team expertise.",
  "scope": ["PostgreSQL", "primary datastore", "relational data"],
  "cross_refs": [],
  "locked": true,
  "precedence": null,
  "notes": ""
}

Exemplar 2 — Ambiguous / UNKNOWN case

Input: file docs/notes/meeting-2024-01-15.md, first 50 lines contain:

# Meeting notes Jan 15
Discussed caching options. No decision reached.
Bob mentioned Redis might be faster. Action: revisit next week.

Output:

{
  "source_path": "docs/notes/meeting-2024-01-15.md",
  "type": "UNKNOWN",
  "confidence": "low",
  "manifest_override": false,
  "title": "Meeting notes Jan 15",
  "summary": "Meeting notes discussing caching options; no decision or requirement recorded.",
  "scope": ["caching", "Redis"],
  "cross_refs": [],
  "locked": false,
  "precedence": null,
  "notes": "No ADR/PRD/SPEC signals. Prose-only meeting notes. No status field, no decision statement, no requirements. Mark as UNKNOWN — user must type-tag via manifest."
}

Exemplar 3 — Edge case: PRD with ADR-like section header

Input: file docs/prd/user-auth.md, contains:

# User Authentication PRD
## User Stories
As a user, I want to log in with email+password.
## Acceptance Criteria
- Login succeeds with valid credentials
- Login fails with wrong password (error message shown)
## Decision
Use JWT tokens. (inherited from ADR-0005)

Output (note: one ## Decision section inherited from ADR does NOT override strong PRD signals):

{
  "source_path": "docs/prd/user-auth.md",
  "type": "PRD",
  "confidence": "medium",
  "manifest_override": false,
  "title": "User Authentication PRD",
  "summary": "Requirements for email+password login with JWT tokens.",
  "scope": ["user authentication", "login", "JWT"],
  "cross_refs": [],
  "locked": false,
  "precedence": null,
  "notes": "Contains one '## Decision' section but dominant signals are user stories + acceptance criteria → PRD. ADR reference recorded in cross_refs if a link is present."
}

</few_shot_exemplars>

<why_this_matters> Your classification drives extraction. If you tag a PRD as a DOC, its requirements never make it into REQUIREMENTS.md. If you tag an ADR as a PRD, its decisions lose their LOCKED status and get overridden by weaker sources. Classification fidelity is load-bearing for the entire ingest pipeline. </why_this_matters>

Read the full file on GitHub · 276 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. yesterday First seen · 276 lines · 63 tokens per session scan A 96b6722fb4ba

Subscribe to this mod's changes

gsd-doc-classifier is an agent published in the GitHub repository open-gsd/gsd-core (8,909 stars, last pushed 2d ago), licensed MIT. It adds 63 tokens to every session and 2,901 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. It is 94% identical to gsd-doc-classifier, differing in 107 lines, and is treated as a copy.