Skip to main content

SpecNest

SpecNest is a CLI for validating and coordinating spec-driven development. It stores plans, tasks, and architecture decision records (ADRs) as Markdown with YAML metadata. Humans review and approve the specifications; implementers use the CLI to find and update ready tasks.

The CLI uses a small, fixed documentation layout in the consuming project. Initialization provides starter agent profiles for a choice of AI harnesses, which you can adapt to your project; SpecNest does not execute agents or install automation.

Installation

SpecNest requires Python 3.11 or newer. From a checkout of this repository, install it into your Python environment:

python -m pip install .
specnest --version

PyYAML is installed as a dependency. python -m specnest is equivalent to specnest if the environment's scripts directory is not on your PATH.

Optional short alias

To type sn instead of specnest, run:

specnest shortcut          # creates sn next to the specnest executable
specnest shortcut spn      # or choose a different name
specnest shortcut --remove # removes sn (only if SpecNest created it)

SpecNest creates the shortcut only if the name is free. It refuses if the name is already used by a file in the target directory, an executable on PATH, or a zsh or bash alias, function, builtin, or reserved word. The shortcut is a relative symlink to specnest, so it continues to work after upgrades. It is opt-in because Python packages cannot safely check for name collisions during installation.

Shell completion

The installed specnest command supports explicit shell completion through argcomplete. Keep specnest and register-python-argcomplete on PATH from the same active Python environment; for example, activate the virtual environment where SpecNest is installed before registering completion. These commands only activate completion in the current shell session:

Bash

eval "$(register-python-argcomplete --shell bash specnest --complete-arguments -o nospace)"

Zsh

If Zsh's completion system is not already initialized in the session, run compinit first:

autoload -Uz compinit
compinit
eval "$(register-python-argcomplete --shell zsh specnest)"

Fish

register-python-argcomplete --shell fish specnest | source

PowerShell 7

register-python-argcomplete --shell powershell specnest | Out-String | Invoke-Expression

For example, after activation, press Tab at the end of each partial command:

Shell Command SpecNest candidates
Bash specnest n new, next
Zsh specnest task PLAN-0001-T01 --status bl blocked
Fish specnest init --harness co codex, copilot
PowerShell specnest new "A title" --o --owner

The completion is static: it uses the parser's commands, options, and fixed choices for new (plan, adr), task --status, and init --harness. It does not look up plans, ADRs, tasks, owners, or approvers, and it does not suggest free-form values or filesystem paths. You can also complete fixed choices after a quoted root path, for example:

specnest --root "/path/with spaces/project" init --harness co

SpecNest suppresses its default file completer. The Bash registration above also replaces Bash's default filename fallback for this command. Other shells and user-installed shell plugins may provide their own fallback suggestions; those are separate from SpecNest's candidates.

To keep completion enabled in new sessions, you may manually add the relevant activation command to your shell's startup file (for example, ~/.bashrc, ~/.zshrc, Fish's ~/.config/fish/config.fish, or your PowerShell profile). SpecNest never edits these files or enables global completion. To disable a persistent registration, remove the line you added and start a fresh shell.

The completion workflow tests Python 3.11 with Bash, Zsh, and Fish on Linux and PowerShell 7 on Windows. It prints the shell versions tested in each run. Other shell versions and operating-system combinations are unverified. The registrations target the specnest executable; if you installed the optional sn shortcut, you may explicitly include sn as another executable in the upstream register-python-argcomplete command.

Quick start

The following example is for a new or empty consuming project. If your project already has these files, integrate the examples rather than overwriting them. Run the commands from that project's root.

  1. Initialize the project, replacing alice with a human approver's GitHub handle:

    specnest init --approver alice
    

    You can omit --approver to enter the handle interactively. It is required for a new configuration when input is not interactive. The command creates docs/specs.config.yaml, starter plan and ADR templates, and planner, implementer, and reviewer agent profiles.

    Select your agent harness with --harness; the default is copilot. For example, to use Claude Code instead:

    specnest init --approver alice --harness claude
    
    Harness Project agent files
    copilot .github/agents/*.agent.md
    claude (Claude Code) .claude/agents/*.md
    codex .codex/agents/*.toml
    gemini (Gemini CLI) .gemini/agents/*.md
    cursor .cursor/agents/*.md

    Specify --harness each time if not using Copilot. You can repeat init with another harness to add its profiles. Existing files are never overwritten, including older starter profiles; update those manually if desired. For harnesses that use profile metadata for identity, profiles with the same agent name are reused even under a different filename. If a default filename contains a different or invalid agent, rename or fix it before retrying. If a configuration already exists, an explicitly supplied approver must already be listed there. Initialization rejects symlinked directories rather than writing through them.

    The profiles are guidance, not a permission boundary: configure your harness's tools and permissions separately, and keep approval with humans. Your harness may require trusting the project or starting a new session before it discovers new profiles.

  2. Create docs/architecture/decisions/ADR-0001-use-python.md:

    ---
    id: ADR-0001
    title: Use Python for the smoke check
    status: proposed
    owner: alice
    created: 2025-01-01
    updated: 2025-01-01
    supersedes: []
    ---
    
    # ADR-0001: Use Python for the smoke check
    
    ## Context
    
    The example needs a portable command.
    
    ## Decision
    
    Use Python to print a known string.
    
    ## Consequences
    
    The check requires Python.
    
  3. Create docs/plans/PLAN-0001-add-a-smoke-check.md:

    ---
    id: PLAN-0001
    title: Add a smoke check
    status: review
    owner: alice
    created: 2025-01-01
    updated: 2025-01-01
    adrs: [ADR-0001]
    depends_on: []
    ---
    
    # PLAN-0001: Add a smoke check
    
    ## Context
    
    The example needs a repeatable smoke check.
    
    ## Goals
    
    - Verify a simple Python command.
    
    ## Non-goals
    
    - Monitor a production service.
    
    ## Approach
    
    Follow ADR-0001 and verify the command's output.
    
    ## Tasks
    
    ### PLAN-0001-T01: Verify the smoke check
    
    ```yaml
    status: todo
    depends_on: []
    agent: implementer
    ```
    
    Run the command and check its output.
    
    **Acceptance criteria**
    
    - [ ] `python -c "print('ok')"` prints `ok`.
    
    ## Validation
    
    Repeat the acceptance criterion.
    
    ## Risks
    
    - This example does not check application behavior.
    
  4. Validate, approve the ADR before the plan, and work through the task. Use the configured approver's handle in place of alice:

    specnest validate
    specnest approve ADR-0001 --by alice
    specnest approve PLAN-0001 --by alice
    specnest list
    specnest next --json
    specnest show PLAN-0001-T01
    specnest task PLAN-0001-T01 --status in-progress
    python -c "print('ok')"
    specnest task PLAN-0001-T01 --status done
    specnest validate
    

Completing the last task automatically marks the plan done. SpecNest does not run acceptance criteria or authenticate the person named by --by; use your own review process and access controls.

Commands

specnest --help
specnest <command> --help
Command Purpose
specnest init [--approver HANDLE] [--harness HARNESS] Initialize a project without overwriting existing files.
specnest validate Report errors and warnings across all plans and ADRs. Warnings alone do not fail validation.
specnest list List plans and ADRs, including task progress.
specnest next [--plan PLAN-0001] [--json] Select a ready task from approved plans; resume an in-progress task before a new one within the same plan.
specnest show ID Show a task brief or summarize a plan or ADR.
specnest task ID --status STATUS [--reason TEXT] Update a task. Status is todo, in-progress, done, or blocked; a blocked task requires a reason.
specnest approve ID --by HANDLE Record a human approval and seal the plan or ADR.
specnest new {plan,adr} TITLE [--owner HANDLE] Create a draft from a project-supplied template.
specnest shortcut [NAME] [--bin-dir DIR] [--remove] Create or remove a short alias (default sn) if the name is free.

Without --root, init uses the current directory; other commands search it and its parents for docs/specs.config.yaml. To operate elsewhere, put --root before the command, for example specnest --root /path/to/project init --approver alice.

Exit codes are 0 for success, 1 for validation or workflow errors, 2 for argument errors, and 3 when next finds no ready task. With next --json, the success response contains task, title, status, agent, plan, and plan_path; the no-task response contains "task": null and a list of "reasons".

Repository format and workflow

SpecNest looks for files in these locations, relative to the project root:

docs/specs.config.yaml                  # approvers
docs/plans/PLAN-0001-example.md         # plans
docs/architecture/decisions/ADR-0001-example.md
docs/templates/plan.md                  # required only for "new plan"
docs/templates/adr.md                   # required only for "new adr"
.github/agents/implementer.agent.md     # Copilot; or a profile for another harness
.claude/agents/implementer.md           # Claude Code
.codex/agents/implementer.toml          # Codex
.gemini/agents/implementer.md           # Gemini CLI
.cursor/agents/implementer.md           # Cursor

Only the selected harness's agent files are needed. Referenced agents may be defined in any supported harness directory. SpecNest identifies Copilot agents by their filenames; the other harnesses use the profile's name (Cursor also supports its filename when name is omitted). Task briefs list matching profile paths.

Plan and ADR filenames must start with their ID; PLAN-0001.md and ADR-0001.md are also accepted. Both types require id, title, status, owner, created, and updated front matter; dates use YYYY-MM-DD. The H1 must be # ID: Title. Plans need Context, Goals, Non-goals, Approach, Tasks, Validation, and Risks sections; ADRs need Context, Decision, and Consequences. Incomplete sections and placeholders are warnings in drafts and errors when the document is ready for review or approval.

Under a plan's ## Tasks section, each task has a heading such as ### PLAN-0001-T01: Title, followed immediately (apart from blank lines) by a fenced YAML metadata block and an Acceptance criteria list. The metadata may contain status, depends_on, agent, and blocked_reason; task dependencies are task ID lists, and the default agent is implementer. Plan depends_on and adrs are lists of plan IDs and ADR IDs respectively. The validator checks references, task and plan dependency cycles, agent files, statuses, and approval seals.

A typical lifecycle is:

  1. Write a draft plan or ADR, fill in its content, then set its status to review (plan) or proposed (ADR).
  2. Run specnest validate. A human approver accepts referenced ADRs and then approves the plan. Approved plans may only rely on accepted ADRs.
  3. Use next, show, and task to work in dependency order. A plan waits for prerequisite plans to be done; a task waits for prerequisite tasks to be done. Use --status blocked --reason "..." when work cannot proceed.
  4. After the last task is done, the plan becomes done. Reopening a completed task is rejected when dependent work has already started.

Approvals detect changes to sealed content. Task status and blocked reason, along with selected administrative front matter, may change without breaking the seal. To amend an approved plan, return it to review, remove its approval block, make the changes, and have a human approve it again. A deprecated or superseded ADR puts dependent approved plans on hold until they are amended and re-approved. See Architecture for details and limitations.

Scaffolding drafts

new needs docs/templates/plan.md or docs/templates/adr.md in the consuming project. init copies the bundled plan and ADR templates there if they do not already exist. It also copies the bundled agent templates to the selected harness's project directory. You can edit or replace the copied files with your own:

specnest new plan "Improve the smoke check" --owner alice
specnest new adr "Choose a test runner" --owner alice

Templates use {{id}}, {{title}}, {{owner}}, and {{date}} substitutions. The owner defaults to the first configured approver. Fill in the resulting drafts and replace their placeholders before review.

Development

With uv installed, set up the locked development dependencies and run the test suite from this checkout:

uv sync --locked
make test

The tests use temporary project directories; they do not require a GitHub account or modify a consuming project. Without Make, run uv run --locked python -m pytest -q instead.

Contributing

Issues and pull requests are welcome. Before opening a pull request, run make test and describe the changes and their intended behavior.

By submitting a contribution, you confirm that you have the right to submit it and agree to license it under the project's MIT license.

Publishing

Releases go to TestPyPI first, then to PyPI:

Command What it does
make publish-test Runs the tests, builds the sdist and wheel in dist/pypi, and uploads the current version to TestPyPI.
make verify-test Installs the current version's wheel from TestPyPI in an isolated environment and checks specnest --version.
make publish Runs the tests, builds, verifies the TestPyPI release, and uploads the same version to PyPI.

make publish stops before uploading if the current version is not installable from TestPyPI. PyPI and TestPyPI versions are immutable and public; use a new version for every release and keep the version in pyproject.toml and src/specnest/__init__.py in sync.

Uploads authenticate with API tokens, never with a username and password. TestPyPI and PyPI are separate services, so create an account, enable 2FA, and create an API token on each: TestPyPI and PyPI. The first upload of a new project needs an account-scoped token; afterward, replace it with a project-scoped token. Both registries upload through their /legacy/ endpoint, which is PyPI's current upload API despite its name.

In Bash or Zsh, enter each token without echoing it or saving it in shell history:

printf 'TestPyPI token: '
read -rs TEST_PYPI_TOKEN; echo
export TEST_PYPI_TOKEN
make publish-test
make verify-test
unset TEST_PYPI_TOKEN

printf 'PyPI token: '
read -rs PYPI_TOKEN; echo
export PYPI_TOKEN
make publish
unset PYPI_TOKEN

Do not commit tokens.

Publishing from GitHub Actions

.github/workflows/publish.yml publishes with Trusted Publishing, so no tokens are stored in GitHub:

  • Run workflow (manual) runs the tests, builds, uploads to TestPyPI, and verifies the install.
  • Pushing a vX.Y.Z tag does the same, then uploads the same files to PyPI. The tag must match the version in pyproject.toml.

See the release management guide for one-time setup, the complete release procedure, and local publishing details.

To release:

git tag vX.Y.Z
git push origin vX.Y.Z

License

The package is distributed under the MIT license. The implementation and license are attributed to A42SS; see LICENSE for the full terms.

The software is provided as is, without warranty. Use it at your own risk: review changes and keep backups before running commands that modify files.

Metadata

Release files for specnest 1.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for specnest 1.2.0
File Size Uploaded Provenance Actions
specnest-1.2.0.tar.gz 64.4 kB Without provenance Details for specnest-1.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for specnest 1.2.0
File Interpreter ABI Platform Actions
specnest-1.2.0-py3-none-any.whl Python 3 none any Details for specnest-1.2.0-py3-none-any.whl

Total release size: 102.8 kB

Release files / specnest-1.2.0.tar.gz

Download URL specnest-1.2.0.tar.gz
Size 64.4 kB
Tags Source
SHA-256 checksum
How to use checksums
30179ddff499e35e8becd124ae93b1f30da46d822c6e47c6bc12278ab0153c22
BLAKE2b-256 checksum
How to use checksums
280242ab6aebdebc8f2330d192c495cf92ebd6e7ea7114218c13a907ff3e1315
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.10 {"installer":{"name":"uv","version":"0.13.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / specnest-1.2.0-py3-none-any.whl

Download URL specnest-1.2.0-py3-none-any.whl
Size 38.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f3a853c8b8ba0e2779e30de0c994f8b07b0995068594a545d94f05fef5952102
BLAKE2b-256 checksum
How to use checksums
55c8d8fde8527947710fd4d19bc48071ace5c5bd1be52d6a102a178f40610450
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.10 {"installer":{"name":"uv","version":"0.13.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for specnest 1.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page