clone

a hermes agent plugin for openspec: tools for spec workflows and a dashboard tab for browsing changes and specs

change: spec-first-class-tools — proposal and spec delta for spec create/show/list

dami etoile committed be08e83
commit
be08e83798ef9cdd23a44df6c34760a9b566889a
parent
b6ca4cfe7d8aab8851a04d96876a6986cb33fdd2
author
dami etoile <dami.etoile@gmail.com>
5 files changed, +105 -0
Aopenspec/changes/spec-first-class-tools/.openspec.yaml2+
Aopenspec/changes/spec-first-class-tools/proposal.md30++++++++++++++++++++
Aopenspec/changes/spec-first-class-tools/specs/agent-tools/spec.md46++++++++++++++++++++++++++++++
Aopenspec/changes/spec-first-class-tools/specs/spec-first-class-tools/spec.md11+++++++
Aopenspec/changes/spec-first-class-tools/tasks.md16++++++++++
A openspec/changes/spec-first-class-tools/.openspec.yaml +2 -0
A openspec/changes/spec-first-class-tools/proposal.md +30 -0
@@ -0,0 +1,30 @@
1+## Why2+3+Specs are the only core OpenSpec artifact without first-class agent tools. Changes have create→promote→archive. Ideas have create→enrich→promote. Specs require hand-writing markdown after calling `openspec_instructions(artifact=specs)` for the authoring guide — no structured create, no filesystem-backed read, no dedicated list. This blocks agents from programmatically creating and inspecting specs without the CLI binary.4+5+## What Changes6+7+- Add `openspec_spec_create` — structured input (title, purpose, requirements array with scenarios) → writes properly formatted `spec.md`. `change` param scopes to change delta specs; omitting it targets baseline specs.8+- Add `openspec_spec_show` — reads a spec as structured JSON using the existing `spec_parser.parse_spec`. Works on both change and baseline specs. Filesystem-backed (no CLI needed).9+- Add `openspec_spec_list` — lists specs within a change, or baseline specs. Filesystem-backed.10+- Add `spec_to_markdown` serializer to `spec_parser.py` — inverse of `parse_spec`, converts structured input to `### Requirement:` / `#### Scenario:` format.11+12+All three tools are filesystem-backed (always available, like idea/change tools). `spec_show` and `spec_list` reuse `spec_parser.py` from the semantic diff work.13+14+## Capabilities15+16+### New Capabilities17+- None.18+19+### Modified Capabilities20+- `agent-tools`: Add spec lifecycle tools for create, show, and list workflows.21+22+## Impact23+24+- `spec_parser.py` — add `spec_to_markdown` serializer25+- `schemas.py` — three new schemas26+- `tools.py` — three new handlers27+- `__init__.py` — register three new tools28+- `plugin.yaml` — declare three new tools29+- `README.md`, `docs/tool-reference.md` — tool count and table updates30+- Tests for structured create, parse round-trip, overwrite protection, change vs baseline scoping, and listing
A openspec/changes/spec-first-class-tools/specs/agent-tools/spec.md +46 -0
@@ -0,0 +1,46 @@
1+# Agent OpenSpec Tools Delta2+3+## MODIFIED Requirements4+5+### Requirement: Spec lifecycle tools6+The plugin SHALL provide filesystem-backed tools for creating, reading, and listing specs so agents can manage specs as first-class artifacts without the OpenSpec CLI binary.7+8+#### Scenario: Create a baseline spec9+- **GIVEN** a project with an `openspec/specs/` directory10+- **WHEN** an agent calls `openspec_spec_create` with a spec name, title, purpose, and requirements array (each with name, description, and optional scenarios)11+- **THEN** the tool writes a properly formatted `openspec/specs/<name>/spec.md` using `### Requirement:` and `#### Scenario:` markdown and returns `ok: true` with the spec name and relative path12+13+#### Scenario: Create a change-scoped spec14+- **GIVEN** a project with an active change15+- **WHEN** an agent calls `openspec_spec_create` with a `change` parameter and a spec name16+- **THEN** the tool writes the spec under `openspec/changes/<change>/specs/<name>/spec.md` instead of the baseline directory17+18+#### Scenario: Refuse to overwrite existing spec19+- **GIVEN** a spec already exists at the target path20+- **WHEN** an agent calls `openspec_spec_create` without a `force` flag21+- **THEN** the tool returns `ok: false` and does not modify the existing file22+23+#### Scenario: Show a spec as structured JSON24+- **WHEN** an agent calls `openspec_spec_show` with a spec name and optional `change` id25+- **THEN** the tool reads and parses the spec using `spec_parser.parse_spec` and returns `ok: true` with the title, purpose, and an array of requirements (each with name, description, and scenarios)26+27+#### Scenario: Show missing spec28+- **WHEN** an agent calls `openspec_spec_show` for a spec that does not exist29+- **THEN** the tool returns `ok: false` with a clear error30+31+#### Scenario: List baseline specs32+- **WHEN** an agent calls `openspec_spec_list` without a `change` parameter33+- **THEN** the tool returns `ok: true` with an array of spec names found under `openspec/specs/`34+35+#### Scenario: List change-scoped specs36+- **WHEN** an agent calls `openspec_spec_list` with a `change` parameter37+- **THEN** the tool returns `ok: true` with an array of spec names found under `openspec/changes/<change>/specs/`38+39+#### Scenario: List specs when none exist40+- **GIVEN** the target specs directory is empty or missing41+- **WHEN** an agent calls `openspec_spec_list`42+- **THEN** the tool returns `ok: true` with an empty array43+44+#### Scenario: Invalid workdir45+- **WHEN** any spec tool is called with a missing or non-directory workdir46+- **THEN** the tool returns `ok: false` and does not perform filesystem operations
A openspec/changes/spec-first-class-tools/specs/spec-first-class-tools/spec.md +11 -0
A openspec/changes/spec-first-class-tools/tasks.md +16 -0