ProductSpec README

The project's README from github.com/gokulrajaram/ProductSpec. As one markdown file: README.md.

ProductSpec

CI npm License: MIT

ProductSpec is the open standard for product intent. It acts as a Product Harness for AI-native software work: what to build, what not to build, how to prove completion, and when intent changes.

It gives teams and agents a portable way to define intent up front, attach evidence after work starts, and preserve what changed when reality disagreed.

Use it when consequential software work needs intent to survive handoff: from product to engineering, from humans to agents, and from implementation back to learning.

Product Spec -> Engineering Spec -> Code -> Evaluation -> Learning
what / why      how / plan / tasks   implementation   outcome

For agent-led work, ProductSpec gives coding agents a product contract:

Product Spec
  -> MCP tools
  -> coding agent
  -> implementation
  -> Agent Run receipt
  -> Related Artifacts
  -> Decision Trace
  -> revised Product Spec

Product Spec is the core artifact. Agent Run and Decision Trace are optional companion artifacts: use them when agents implement against a spec or when evidence changes the decision.

ProductSpec is neutral. It defines structure, section IDs, portable review annotations, calibration-example serialization, and portable decision traces. It does not define what makes a Product Spec good.

Design principle: structure the parts machines must execute or compare. Leave the parts humans must reason about readable.

ProductSpec acts as a Product Harness for agent-led work. The Product Spec tells Claude, Codex, Cursor, and other coding agents what to build, what not to build, how to prove completion, and when to stop and re-plan. For those agents, ProductSpec provides an intent harness: structured context, scope guardrails, acceptance criteria, evals, evidence targets, and revision checks. The repo includes skills/productspec/SKILL.md, a loadable agent skill that tells coding agents how to read Product Specs, cite Acceptance Criteria, respect scope, and propose a Decision Trace when implementation diverges from intent. skills/productspec-authoring/SKILL.md covers the other direction: writing a Product Spec, validating it, and converting an existing PRD into one. Both are installable with npx skills add gokulrajaram/ProductSpec.

Agent Run is the optional companion artifact for recording what happened when an agent used ProductSpec as its product contract: the pinned spec revision, checked criteria and evals, linked evidence, drift status, and completion claim.

Decision Trace is the optional companion standard for recording how consequential decisions, drift, revisions, and outcomes are handled over time.

Intent -> Implementation -> Drift -> Decision Trace -> Revised Intent

What Agents Can Do Today

With the parser, CLI, MCP server, and companion artifacts in this repo, agents can:

ProductSpec does not tell the agent how to code. It tells the agent what intent it is accountable to.

Repo Maintenance Commands

Once Product Specs live in a repo, use these commands to operate the Product Harness across many files:

# Scan repo health: specs, runs, traces, graph, evidence, stale revision pins
npm exec --package @productspec/parser -- productspec garden .

# Check whether one Agent Run satisfies one Product Spec revision
npm exec --package @productspec/parser -- productspec reconcile docs/product-specs/my-feature.product-spec.md --against docs/agent-runs/my-feature.agent-run.json

# Open a local read-only dashboard over the same garden report
npm exec --package @productspec/parser -- productspec serve . --port 4317

See docs/repo-maintenance.md for the full semantics.

Intent And Evidence

ProductSpec defines what should be built and why.

Evidence shows what happened after work started: pull requests, tests, eval runs, dashboards, analytics snapshots, releases, and support signals.

Use Related Artifacts to attach evidence to durable ProductSpec IDs:

Updating evidence links does not automatically require a spec_revision bump. Bump spec_revision when evidence changes the meaning of the product intent: scope, acceptance criteria, user experience, success metrics, or the underlying bet. Use Decision Trace when evidence changes the product decision.

ProductSpec does not collect traces or run evals. It gives evidence a stable intent target.

Living Specs

Product Specs are living documents. They should change when evidence, scope, design, acceptance criteria, or success metrics change.

spec_revision gives each meaningful revision a portable handle:

spec_format_version: "0.1" # ProductSpec standard version
spec_revision: 1           # initial product intent
spec_revision: 2           # scope changed after design review
spec_revision: 3           # acceptance criteria updated before implementation

Git keeps the detailed history. spec_revision lets people and tools cite the intent revision they are using: a Jira ticket, an engineering spec, an AI agent loop, a pull request, or a Decision Trace.

See examples/revisions/ for a Product Spec that evolves from revision 1 to revision 2.

Quick Start

ProductSpec Product Harness loop

If you want to use ProductSpec as a Product Harness for coding agents, start here:

  1. Try the Product Harness demo:
npm exec --package @productspec/parser -- productspec validate examples/harness-demo/checkout-notifications.product-spec.md
  1. Generate an Agent Handoff:
npm exec --package @productspec/parser -- productspec handoff examples/product-harness/video-transcript.product-spec.md
  1. Start the MCP server:
npx --yes -p @productspec/parser@latest productspec mcp

Generate a Claude or Cursor MCP config:

npx --yes -p @productspec/parser@latest productspec mcp-config claude
  1. Ask Claude, Codex, Cursor, or another MCP-aware agent to implement against the Product Spec:
Use ProductSpec MCP before coding.
Validate examples/harness-demo/checkout-notifications.product-spec.md, call begin_spec_session, load Product Summary, Scope, Acceptance Criteria, AI Evals, Success Metrics, Related Artifacts, and Agent Handoff.
Stay inside scope.in, avoid scope.out and scope.cut, verify every AC- and EVAL- item, call check_spec_session before claiming done, and draft an Agent Run receipt.
  1. Draft the run receipt:
npm exec --package @productspec/parser -- productspec init-run examples/harness-demo/checkout-notifications.product-spec.md /tmp/checkout-notifications.agent-run.json
  1. Validate the checked-in example receipt and trace:
npm exec --package @productspec/parser -- productspec validate-run examples/harness-demo/checkout-notifications.agent-run.json
npm exec --package @productspec/parser -- productspec validate-trace examples/harness-demo/checkout-notifications.decision-trace.json

Try This With Your Coding Agent

  1. Pick a real feature you would otherwise describe in a PRD, ticket, or chat thread.
  2. Write a Product Spec for it, or start from examples/product-harness/video-transcript.product-spec.md.
  3. Validate it:
npm exec --package @productspec/parser -- productspec validate path/to/your.product-spec.md
  1. Generate the Agent Handoff:
npm exec --package @productspec/parser -- productspec handoff path/to/your.product-spec.md
  1. Paste the handoff into Claude, Codex, Cursor, or another coding agent.
  2. Require evidence for every AC-<number> and EVAL-<number> before the agent claims completion.
  3. If implementation pressure changes product intent, update the Product Spec or record a Decision Trace.

Create a starter Product Spec:

npm exec --package @productspec/parser -- productspec init my-feature.product-spec.md

Prefer an editor?

You can also draft and validate Product Specs in the free browser editor at ProductSpec.io. The open standard does not require the hosted editor.

Resolve a folder of specs into a build graph:

npm exec --package @productspec/parser -- productspec graph conformance/graph

The graph answers the fleet question too: which specs are safe to hand to different agents at the same time. It reports contention (the surfaces more than one live spec touches, read from applies_to) and waves (sets of specs that share no surface and whose dependencies are already met), so two agents never land in the same files and find out at merge.

Read and inspect a spec from the shell:

npm exec --package @productspec/parser -- productspec list specs
npm exec --package @productspec/parser -- productspec get path/to/your.product-spec.md acceptance --json
npm exec --package @productspec/parser -- productspec check-claim path/to/your.product-spec.md

The CLI reaches every operation the MCP does: validate, list, show, read a section (scope, acceptance, evals, metrics, related, evidence), graph, generate a handoff, check a completion claim, and pin or check a session for drift. Every read command supports --json, so anyone who finds MCP overkill can do the same work from a plain terminal. See the CLI reference for all commands and flags. The CLI and the MCP call the same functions, so their output cannot drift.

Garden the whole repo for missing evidence, stale revision pins, run gaps, Decision Trace gaps, and graph health:

npm exec --package @productspec/parser -- productspec garden .

Reconcile one implementation run against one Product Spec revision:

npm exec --package @productspec/parser -- productspec reconcile docs/product-specs/my-feature.product-spec.md --against docs/agent-runs/my-feature.agent-run.json

Serve the same repo-health view locally:

npm exec --package @productspec/parser -- productspec serve . --port 4317

See docs/repo-maintenance.md for the command semantics.

Status Badges

ProductSpec badges should report facts, not subjective quality scores.

ProductSpec: valid
ProductSpec: rev 3
Agent Run: recorded
Evidence: 4 linked artifacts
ProductSpec graph: buildable

See docs/status-badge.md for the recommended badge vocabulary.

Use the GitHub Action in a repository:

name: ProductSpec

on:
  pull_request:

jobs:
  validate-product-specs:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: gokulrajaram/ProductSpec@main
        with:
          files: "docs/product-specs/**/*.product-spec.md"
          decision_traces: "docs/decision-traces/**/*.decision-trace.json"
          agent_runs: "docs/agent-runs/**/*.agent-run.json"

How To Contribute Without Coding

Product leaders and builders can shape ProductSpec without touching parser code:

See CONTRIBUTING.md for exact issue and pull request steps.

Example

Full Product Spec files include frontmatter such as title, optional spec_revision, author, and timestamps. This shortened example shows the section body.

## Problem

Support leads at B2B SaaS companies lose their morning planning window because urgent, account-risk tickets are buried among routine product questions.

## Hypothesis

If incoming tickets are automatically labeled by urgency, customer tier, and likely owner, support leads will respond to account-risk issues faster because the queue starts each day pre-sorted by consequence.

## Product Summary

An AI support triage workflow labels incoming tickets by urgency, customer tier, likely owner, and confidence so support leads can start from an ordered queue.

## Scope

```productspec-scope
in:
  - Include ticket ingestion in this version.
  - Include urgency labels in this version.
  - Include customer-tier lookup in this version.
  - Include owner recommendation in this version.
  - Include confidence score in this version.
  - Include reviewer override in this version.
  - Include audit log in this version.
out:
  - Do not build auto-replies in this version.
  - Do not build direct ticket reassignment in this version.
  - Do not build customer-visible status changes in this version.
cut:
  - Cut custom routing rules from the first version if implementation time is tight.
```

## Acceptance Criteria

```productspec-acceptance-criteria
- id: AC-1
  criterion: New tickets receive urgency, customer tier, suggested owner, confidence score, and model version within 60 seconds.
- id: AC-2
  criterion: Reviewers can override any label before it changes downstream workflow state.
```

```productspec-ai-evals
- id: EVAL-1
  type: llm_judge
  cases:
    - input: "Representative input for this eval."
      expected: "Expected behavior for this eval."
  evaluator: llm
  pass_threshold: 0.92
  checks:
    - urgency classification identifies account-risk tickets
```

## Success Metrics

```productspec-success-metrics
- id: SM-1
  metric: median_time_to_first_human_response
  target: "< 15 minutes"
  target_status: committed
  window: business hours
```

See examples/ai-support-triage.product-spec.md for the complete version.

Naming

When To Use ProductSpec

ProductSpec is not for every act of building. It is for consequential software work where intent needs to survive handoff.

For an individual builder, a Product Spec is useful when the work is complex, risky, long-lived, or being handed to an AI agent loop. For quick experiments, one-off scripts, or throwaway prototypes, it may be faster to brainstorm, build, and iterate directly.

For a team or organization, ProductSpec is most useful when coordination cost appears: multiple people, multiple agents, design and engineering handoffs, customer-facing launches, AI features with evals, or decisions that will need to be revisited later.

Where This Sits

ProductSpec operates at the software intent layer: the what and why that come before engineering specs are written. This is where a team commits to the problem, hypothesis, product summary, scope, user experience, acceptance criteria, and success metrics.

OpenSpec and Spec Kit operate at the engineering spec layer. OpenSpec's flow is propose -> apply -> archive. Spec Kit's flow is constitution -> specify -> clarify -> plan -> tasks -> analyze -> implement. Those artifacts live in the repo and are consumed by AI agents to build code.

Product Spec (ProductSpec) -> Engineering Spec (OpenSpec / Spec Kit) -> Code (agents)
what / why                       how / plan / tasks                         implementation
strategic intent                 technical decomposition                    running system

Both layers are SDD. Both use the spec as a control system. They serve different roles with different artifacts.

Where ProductSpec Fits

ProductSpec does not replace Git, Jira, Linear, Figma, analytics tools, OpenSpec, Spec Kit, or AI coding agents.

It sits upstream of them.

ProductSpec -> Engineering Spec -> Tasks -> Code -> Evaluation -> Learning

Ecosystem

ProductSpec is meant to be implemented by many tools.

Current repo artifacts:

Durable IDs are generated for the top-level items that tools execute or compare: AC-1 for Acceptance Criteria, SM-1 for Success Metrics, and EVAL-1 for AI evals. Scope bullets, eval cases, optional eval checks, and prose/custom sections remain un-IDed. Tools that need to cite eval children should use positional references like EVAL-1.case[2].

Success Metrics may be committed when the target is known, or provisional when the team knows the metric but needs post-launch baseline work before committing the threshold. Provisional targets must name a target_owner.

Natural integration points:

Traceability uses two shapes:

Early ecosystem contributions are welcome: examples, importer/exporter experiments, editor integrations, CI validation actions, review tools, and mappings into engineering-spec systems.

Want a small first contribution? Start with pinned issue #43: add a real Product Harness example.

What Is Included

Examples include AI features, consumer UX, enterprise workflows, internal APIs, and agent handoffs:

Canonical Sections

Mandatory sections, in order:

  1. problem
  2. hypothesis
  3. product_summary
  4. scope
  5. acceptance_criteria
  6. success_metrics

Optional sections:

user_experience, customer_truth, solution_alternatives, solution, strategic_positioning, adoption, pricing, risks, ai, open_questions, rollout, related_artifacts

user_experience describes the externally observable experience of the work when there is one: for example, a prototype URL, mockup, design link, public deploy, Loom walkthrough, API documentation page, CLI demo, dashboard, or internal tool screen.

Custom sections use custom-<kebab-name>.

Status

Version 0.1 is intentionally small. It is stable enough for tooling experiments, but still pre-1.0 while implementers learn what needs to change. See docs/versioning.md for compatibility expectations.

ProductSpec distinguishes the standard version from the document revision:

The current v0.x standard includes conformance fixtures, a structured validator, examples, a CLI, optional spec_revision frontmatter, traceability fields, an MCP server, a loadable agent skill, a copyable repo starter kit, generated Agent Handoffs, Decision Trace validation, Agent Run drafting and validation, repo gardening, reconciliation, and a local read-only dashboard:

npm exec --package @productspec/parser -- productspec validate examples/minimal.product-spec.md

To validate a Decision Trace:

npm exec --package @productspec/parser -- productspec validate-trace examples/decision-traces/transcript-search.decision-trace.json

To validate an Agent Run:

npm exec --package @productspec/parser -- productspec validate-run examples/agent-ready-repo/docs/agent-runs/transcript-search.agent-run.json

To draft an Agent Run from a Product Spec:

npm exec --package @productspec/parser -- productspec init-run examples/minimal.product-spec.md examples/minimal.agent-run.json

To generate an Agent Handoff from a Product Spec:

npm exec --package @productspec/parser -- productspec handoff examples/product-harness/video-transcript.product-spec.md

To create a starter Product Spec:

npm exec --package @productspec/parser -- productspec init my-feature.product-spec.md

For local development from this repository:

npm install
npm run build
node dist/cli.js validate examples/minimal.product-spec.md

Or use the shortcut:

npm run validate -- examples/minimal.product-spec.md

To run the local productspec CLI without a global install:

npm run cli -- validate examples/minimal.product-spec.md

To link the CLI during development:

npm run link:cli

After linking, productspec validate examples/minimal.product-spec.md works if your npm global binary directory is on PATH.

See docs/validate-your-first-product-spec.md for the first-run path and current validator checks.

See docs/adoption.md for a practical team setup across Git, Jira, Linear, Figma, CI, engineering specs, and AI coding agents.

ProductSpec (gokulrajaram/ProductSpec)

Searching Database…

这是什么东西?ProductSpec 是一个开放标准,用来描述产品意图——可以理解为面向 AI 原生软件开发的一套“产品缰绳”(Product Harness),它把要做什么、不做什么、怎样才算完成、以及现实和计划不一致时该怎么办都固定下来。
它是我要安装的工具、一个库,还是只是一种文件格式?既是格式也是工具:规格文件是带有固定章节 ID 的 markdown 文件,仓库里还提供了 TypeScript 编写的解析器、校验器和命令行工具(@productspec/parser)、一个 MCP 服务器,以及两个可安装的 agent skill,用来阅读和撰写规格。
我怎么上手?用 'npx skills add gokulrajaram/ProductSpec' 安装 agent skill,然后写一份 Product Spec,或者把现有的 PRD 转换成一份,用命令行工具校验,再把你的 agent 指向 MCP 服务器。ProductSpec.io 上还有一个免费的浏览器编辑器,可选。
它支持哪些编程 agent?Claude Code、Codex 和 Cursor 都有官方文档教程,任何支持 MCP 的编程 agent 都能用。命令行工具和 MCP 服务器都是 TypeScript 写的,所以唯一真正的依赖就是 Node(npx)。
那它能替我写代码吗?不能——它不会告诉 agent 怎么写代码,只是明确 agent 需要对哪些意图负责。它也不负责跑评测或收集执行轨迹,也不定义什么样的规格才算好:结构是标准化的,判断仍然靠人。
这个标准定义了哪些产物?Product Spec 是核心产物。还有两个可选的配套产物:Agent Run 是 agent 针对某个固定版本的 spec 执行一次的回执(包含检查过的标准、证据、偏差状态和完成声明);Decision Trace 记录决策和偏差是如何随时间处理的。
它和 Spec Kit 或 OpenSpec 有什么区别?这几种方案都是规格驱动的,但 ProductSpec 位于更上游:它保存持久的产品意图(问题、范围、验收标准、指标),而 OpenSpec 和 Spec Kit 是把这些意图转化为 agent 去实现的工程计划和任务。ProductSpec 明确表示不取代它们。
多个 agent 能同时基于这些 spec 工作吗?可以。命令行工具会把一个文件夹里的 spec 解析成一张构建图,标出冲突点(被多个活跃 spec 触及的模块)和批次(彼此不共享模块、且依赖已满足的 spec 分组),这样两个 agent 就不会改到同一批文件、直到合并时才发现冲突。
Spec 是持续演进的文档——修订是怎么管理的?每次有实质意义的修订都会生成一个 specrevision 句柄,工单、agent 会话和 pull request 都可以引用它,同时 Git 保留详细历史。当证据改变了意图本身的含义时(范围、验收标准、UX、成功指标,或底层的产品假设),你就更新这个版本号。
Size
0.8 MB
Stars
308
Age
3mo
Commits · 90 Days