Context
The Automated Capability Discovery Pipeline (grounded_agency/discovery/) can generate typed contracts (input/output JSON schemas, risk levels, layer assignments, edges) for proposed capabilities. However, this contract generation logic is embedded inside the GapDetector stage of the full discovery pipeline — there is no standalone entry point for converting a natural language description into a typed contract.
Current State
To generate a typed contract from a description, users must run the full discovery pipeline which includes task analysis, capability matching, gap detection, and workflow synthesis. This is heavyweight for users who simply want to produce a contract for a known capability idea. The relevant logic lives in GapDetector.build_gap_proposal_prompt() and ProposedCapability but cannot be invoked independently.
Objective
Provide a lightweight, single-purpose CLI tool that accepts a natural language capability description and outputs a complete typed contract — including input/output JSON Schemas, layer assignment, risk classification, mutation flag, and suggested ontology edges — ready for integration into the capability ontology.
Proposed Solution
- A CLI entry point that takes a description string and optional parameters (layer hint, risk hint, domain)
- LLM-assisted contract generation leveraging ontology context (existing capabilities, layer descriptions, edge patterns)
- Output in both YAML and JSON formats, selectable via flag
- Reuse of existing
ProposedCapability type and prompt engineering from prompts.py
- Validation of generated contracts against the ontology schema
Tasks
Benefits
- Faster iteration when designing new capabilities — no need to run full discovery
- Lower barrier for contributors proposing new capabilities
- Composable building block — can be piped into
scaffold.py or sync_skill_schemas.py
- Consistent contract quality through ontology-aware LLM generation
Acceptance Criteria
Related Issues
Context
The Automated Capability Discovery Pipeline (
grounded_agency/discovery/) can generate typed contracts (input/output JSON schemas, risk levels, layer assignments, edges) for proposed capabilities. However, this contract generation logic is embedded inside theGapDetectorstage of the full discovery pipeline — there is no standalone entry point for converting a natural language description into a typed contract.Current State
To generate a typed contract from a description, users must run the full discovery pipeline which includes task analysis, capability matching, gap detection, and workflow synthesis. This is heavyweight for users who simply want to produce a contract for a known capability idea. The relevant logic lives in
GapDetector.build_gap_proposal_prompt()andProposedCapabilitybut cannot be invoked independently.Objective
Provide a lightweight, single-purpose CLI tool that accepts a natural language capability description and outputs a complete typed contract — including input/output JSON Schemas, layer assignment, risk classification, mutation flag, and suggested ontology edges — ready for integration into the capability ontology.
Proposed Solution
ProposedCapabilitytype and prompt engineering fromprompts.pyTasks
GapDetectorBenefits
scaffold.pyorsync_skill_schemas.pyAcceptance Criteria
Related Issues