Skip to main content

Reverse-infer OpenSpec specs from code + multi-source context

Project description

English | 繁體中文 | 简体中文 | 日本語

InferSpec

Reverse-infer OpenSpec specs from your codebase + git history + docs — designed for legacy code that has no spec.

CI License: MIT

From Code & Context to Clear Specs

Why InferSpec?

You inherit a 50K-line Flask service. There is no spec. There is a Jira board from three years ago, a Confluence wiki nobody updates, and the git log.

InferSpec reads all of it and produces a structured OpenSpec spec — one spec.md per capability — with each Requirement cited back to file:line or a ticket ID. Ambiguities are marked [GAP]/[TBD] so you can fill them interactively in a follow-up pass.

How it works

┌─────────────────────────────────────────────────────────────┐
│  Layer 1 — uvx Python package: installer + CLI               │
│  (never calls an LLM API)                                   │
└─────────────────────────────────────────────────────────────┘
                       │ installs skills into
                       ▼
┌─────────────────────────────────────────────────────────────┐
│  Layer 2 — Skills run inside Claude Code / Codex / Gemini   │
│  / Copilot / OpenCode and use the host's subscription AI    │
└─────────────────────────────────────────────────────────────┘

InferSpec leans on your existing AI subscription. No API keys, no cloud endpoints to configure.

Install

uvx inferspec init --platform claude-code

That drops /inferspec-scan into .claude/skills/ for the current directory. See inferspec platforms for the full list.

Usage

Open your AI agent in the target repo. Two skills are available:

/inferspec-scan — bulk-infer specs for every capability:

/inferspec-scan

It runs graphify to cluster files into capabilities, then for each cap reads code + git log + docs/ + (if available) Jira/Confluence via MCP + URLs via the host's WebFetch, and drafts openspec/specs/<cap>/spec.md in OpenSpec format. Drafts may contain [GAP] / [TBD] markers where the AI was unsure.

/inferspec-cap <slug> — single-capability deep dive with interactive Q&A:

/inferspec-cap user-auth
/inferspec-cap "rate limiting"       # fuzzy match
/inferspec-cap                       # interactive picker
/inferspec-cap new-feature --new     # bootstrap a brand-new cap

For one capability, the skill solicits Jira/Confluence/URLs you have, then asks one focused question per [GAP] marker until the spec converges. On exit it offers to commit the result for you.

Multi-source artefacts are picked up automatically — InferSpec detects MCP servers in your host environment rather than shipping its own clients.

Output format

Same convention as OpenSpec:

## Purpose

User authentication for the order portal — replaced the legacy SSO bridge
after incident-1234. See AUTH-456.

## Requirements

### Requirement: Rate Limiting
The system SHALL reject login attempts after 5 failures within 60 seconds.

**Source:** auth.py:18-21, [JIRA AUTH-456]

#### Scenario: Lockout after repeated failures
- **GIVEN** 5 failed attempts in the last minute
- **WHEN** another POST /auth/login arrives
- **THEN** server returns 429

Status

v0.2 alpha. Ships /inferspec-scan (bulk mode) + /inferspec-cap (interactive single-cap mode). /inferspec-refine is under evaluation for v0.3.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

inferspec-0.2.0a0.tar.gz (62.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

inferspec-0.2.0a0-py3-none-any.whl (22.0 kB view details)

Uploaded Python 3

File details

Details for the file inferspec-0.2.0a0.tar.gz.

File metadata

  • Download URL: inferspec-0.2.0a0.tar.gz
  • Upload date:
  • Size: 62.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for inferspec-0.2.0a0.tar.gz
Algorithm Hash digest
SHA256 923fed3456f240b5675da18c7afe75334cccc3e6a516a02a1812e5f3b0d7705d
MD5 8fb4e30dccea87df06a8c4e2224a8197
BLAKE2b-256 d68b45dd50eedffaa9a01f67ad0383a791f3d035fc400337f1c6e8f584e209e3

See more details on using hashes here.

Provenance

The following attestation bundles were made for inferspec-0.2.0a0.tar.gz:

Publisher: publish.yml on anrylu/infer-spec

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file inferspec-0.2.0a0-py3-none-any.whl.

File metadata

  • Download URL: inferspec-0.2.0a0-py3-none-any.whl
  • Upload date:
  • Size: 22.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for inferspec-0.2.0a0-py3-none-any.whl
Algorithm Hash digest
SHA256 a9ee7631a307f2fe34b7d8c28768000e36be297b2f2ea8e0127e22a0ed9337f8
MD5 58b5e5a6d6fae401e947663854598f69
BLAKE2b-256 9acc596c29bb78306922b2c0dc0db8c3b47f4d01c2604253e0b9d4bd484e049b

See more details on using hashes here.

Provenance

The following attestation bundles were made for inferspec-0.2.0a0-py3-none-any.whl:

Publisher: publish.yml on anrylu/infer-spec

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page