Skip to content

Commit f7fc264

Browse files
committed
Integrate the SkillOpt in the specmem
1 parent 3afddf5 commit f7fc264

19 files changed

Lines changed: 1390 additions & 39 deletions

CHANGELOG.md

Lines changed: 31 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
88
## [Unreleased]
99

1010
### Added
11-
- Initial release of SpecMem
12-
- Core memory bank with chunking, ranking, and lifecycle management
13-
- SpecIR canonical representation for specifications
14-
- Adapters for Kiro, Cursor, Claude Code, SpecKit, and Tessl
15-
- LanceDB as default vector database backend
16-
- Support for ChromaDB and Qdrant backends
17-
- Local embeddings via SentenceTransformers
18-
- Cloud embedding providers (OpenAI, Anthropic, Google, Together)
19-
- SpecImpact graph for code-to-spec dependency analysis
20-
- SpecDiff for temporal spec intelligence and drift detection
21-
- Test mapping engine with framework-agnostic support
22-
- Streaming context API with token budget optimization
23-
- SpecValidator for specification quality assurance
24-
- CLI with init, scan, build, query, and impact commands
25-
- Python client API for agent integration
26-
- Web UI for browsing and managing specifications
11+
- N/A
2712

2813
### Changed
2914
- N/A
@@ -40,12 +25,41 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
4025
### Security
4126
- N/A
4227

28+
## [0.2.0] - 2026-05-26
29+
30+
### Added
31+
- Optimized skill artifacts for `.codex/skills/*/SKILL.md` and `.claude/skills/*/SKILL.md`.
32+
- `specmem guidelines optimize` for promoting a candidate skill or generating one from an instruction.
33+
- `specmem guidelines score-skill` for static skill quality checks.
34+
- `specmem guidelines optimized-status` for raw, optimized, stale, rejected, and invalid artifact states.
35+
- `specmem build --optimize-skills` to index accepted optimized skill artifacts.
36+
- Optimized skill provenance tags in indexed memory blocks.
37+
- Public `specmem.guidelines` optimized-skill APIs.
38+
- User, CLI, API, and memory-pattern documentation for optimized skills.
39+
40+
### Changed
41+
- Agent guidance indexing can now opt into accepted optimized skill content while keeping default builds unchanged.
42+
43+
### Deprecated
44+
- N/A
45+
46+
### Removed
47+
- N/A
48+
49+
### Fixed
50+
- Fixed package version mismatch between `pyproject.toml`, lockfile metadata, and `specmem.__version__`.
51+
- Prevented generated candidates from being copied over themselves during promotion.
52+
53+
### Security
54+
- N/A
55+
4356
## [0.1.0] - 2025-12-01
4457

4558
### Added
4659
- Initial public release
4760
- Developed as part of the Kiroween Hackathon, December 2025
4861
- IP of Superagentic AI
4962

50-
[Unreleased]: https://github.com/Shashikant86/specmem/compare/v0.1.0...HEAD
63+
[Unreleased]: https://github.com/Shashikant86/specmem/compare/v0.2.0...HEAD
64+
[0.2.0]: https://github.com/Shashikant86/specmem/compare/v0.1.0...v0.2.0
5165
[0.1.0]: https://github.com/Shashikant86/specmem/releases/tag/v0.1.0

docs/advanced/agent-memory-patterns.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,11 @@ Instruction files are pinned by default. Skills are indexed as procedural
5151
memory, but they are not pinned because agents should load them only when the
5252
task matches the skill.
5353

54+
Skills can also be optimized before indexing. SpecMem stores accepted optimized
55+
artifacts under `.specmem/skillopt/` and uses them only when
56+
`specmem build --optimize-skills` is requested. See
57+
[Optimized Skills](../user-guide/optimized-skills.md).
58+
5459
## Demo Flow
5560

5661
Build the memory index:

docs/api/guidelines.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,37 @@ interface ConversionResult {
139139
}
140140
```
141141

142+
### Optimized Skill APIs
143+
144+
The optimized-skill helpers are available from `specmem.guidelines`:
145+
146+
```python
147+
from pathlib import Path
148+
149+
from specmem.guidelines import OptimizedSkillStore, score_skill_static
150+
151+
workspace = Path(".")
152+
store = OptimizedSkillStore(workspace)
153+
154+
score, issues = score_skill_static(
155+
Path(".codex/skills/review/SKILL.md").read_text()
156+
)
157+
158+
result = store.promote_candidate(
159+
Path(".codex/skills/review/SKILL.md"),
160+
Path("/tmp/review-best-skill.md"),
161+
score_before=0.62,
162+
score_after=0.74,
163+
evaluator="codex-rollout",
164+
)
165+
166+
status = store.status(Path(".codex/skills/review/SKILL.md"))
167+
optimized = store.resolve(Path(".codex/skills/review/SKILL.md"))
168+
```
169+
170+
`resolve()` returns `None` when the artifact is missing, rejected, stale, or
171+
invalid. `status()` gives the user-facing state and reason.
172+
142173
## Examples
143174

144175
### List all guidelines

docs/changelog.md

Lines changed: 47 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,27 +8,55 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
88
## [Unreleased]
99

1010
### Added
11-
- **Spec Coverage Analysis** - Analyze gaps between acceptance criteria and tests
12-
- `specmem cov` - Show overall coverage summary
13-
- `specmem cov report` - Detailed coverage report per feature
14-
- `specmem cov suggest` - Get test suggestions for uncovered criteria
15-
- `specmem cov badge` - Generate coverage badge for README
16-
- `specmem cov export` - Export coverage data (JSON/Markdown)
17-
- Coverage API methods in `SpecMemClient`:
18-
- `get_coverage()` - Analyze spec coverage
19-
- `get_coverage_suggestions()` - Get test suggestions
20-
- `get_coverage_badge()` - Generate badge markdown
21-
- Documentation site with MkDocs Material theme
22-
- Comprehensive API reference
23-
- Advanced configuration guide
24-
- User guide for Spec Coverage
11+
- N/A
2512

2613
### Changed
27-
- Improved error messages in CLI
28-
- Updated CLI index with coverage command
14+
- N/A
2915

3016
### Fixed
31-
- Memory leak in large spec collections
17+
- N/A
18+
19+
---
20+
21+
## [0.2.0] - 2026-05-26
22+
23+
### Added
24+
25+
- **Optimized Skills** - Validate and index improved agent skill artifacts
26+
- `specmem guidelines optimize` - Generate or promote optimized skill candidates
27+
- `specmem guidelines score-skill` - Run static quality checks for skills
28+
- `specmem guidelines optimized-status` - Show raw, optimized, stale, rejected, and invalid artifact states
29+
- `specmem build --optimize-skills` - Use accepted optimized skill artifacts during memory indexing
30+
- Optimized skill artifact storage under `.specmem/skillopt/`
31+
- Provenance tags for optimized skill memory blocks
32+
- Public Python APIs for optimized skill artifact management
33+
- User, CLI, API, and advanced memory-pattern documentation for optimized skills
34+
35+
### Changed
36+
37+
- Agent guidance indexing can opt into accepted optimized skill content while default builds keep indexing source skills.
38+
39+
### Fixed
40+
41+
- Aligned package version metadata across `pyproject.toml`, `uv.lock`, and `specmem.__version__`.
42+
- Avoided same-file candidate copy failures during generated skill promotion.
43+
44+
---
45+
46+
## [0.1.1] - 2026-05-26
47+
48+
### Added
49+
50+
- Spec Coverage Analysis commands and docs.
51+
- Documentation site, API reference, and advanced configuration guide.
52+
53+
### Changed
54+
55+
- Improved CLI error messages.
56+
57+
### Fixed
58+
59+
- Memory handling improvements for large spec collections.
3260

3361
---
3462

@@ -100,6 +128,8 @@ First public release of SpecMem - Cognitive Memory Layer for AI Coding Agents.
100128

101129
| Version | Date | Highlights |
102130
|---------|------|------------|
131+
| 0.2.0 | 2026-05-26 | Optimized Skills |
132+
| 0.1.1 | 2026-05-26 | Spec Coverage and documentation |
103133
| 0.1.0 | 2025-12-01 | Initial release |
104134

105135
## Upgrade Guide

docs/cli/build.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ The command uses `.specmem.toml` from the target repository when present.
2727
| Option | Description | Default |
2828
|--------|-------------|---------|
2929
| `--output`, `-o` | Output directory | `<PATH>/.specmem` |
30+
| `--optimize-skills` | Use validated optimized skill artifacts from `.specmem/skillopt` when available | `false` |
3031

3132
## Inputs
3233

@@ -39,6 +40,13 @@ The command uses `.specmem.toml` from the target repository when present.
3940
Instruction files are pinned in memory by default. Skill files are indexed as
4041
procedural memory and selected by task intent.
4142

43+
Optimized skill artifacts are opt-in. Run `specmem guidelines optimize` to
44+
validate and promote a candidate skill, then build with `--optimize-skills` to
45+
index the accepted `best_skill.md` instead of the raw source skill. Artifacts are
46+
ignored if the source skill changed after validation.
47+
48+
See [Optimized Skills](../user-guide/optimized-skills.md) for the full workflow.
49+
4250
## Generated Files
4351

4452
| File | Purpose |
@@ -68,6 +76,12 @@ specmem build ../service-api
6876
specmem build . --output ./build/specmem
6977
```
7078

79+
### Build With Validated Optimized Skills
80+
81+
```bash
82+
specmem build --optimize-skills
83+
```
84+
7185
### Build with Qdrant
7286

7387
Configure Qdrant in `.specmem.toml`:

docs/cli/guidelines.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ specmem guidelines [OPTIONS] [COMMAND]
1616
| `show` | Show full content of a specific guideline |
1717
| `convert` | Convert a guideline to another format |
1818
| `convert-all` | Convert all guidelines to a target format |
19+
| `score-skill` | Score a skill document with static optimization checks |
20+
| `optimize` | Validate and promote an optimized skill artifact |
21+
| `optimized-status` | Show optimized-skill artifact status |
1922

2023
## Options
2124

@@ -122,6 +125,59 @@ specmem guidelines convert-all claude --no-preview
122125
specmem guidelines convert-all steering --source claude --no-preview
123126
```
124127

128+
### Optimize Skill Artifacts
129+
130+
Use `optimize` to generate or promote a candidate `SKILL.md` into
131+
`.specmem/skillopt/`. Accepted artifacts are consumed only when
132+
`specmem build --optimize-skills` is used.
133+
134+
```bash
135+
specmem guidelines score-skill .codex/skills/review/SKILL.md
136+
137+
specmem guidelines optimize .codex/skills/review/SKILL.md \
138+
--instruction "tighten this for code review tasks and make retrieval keywords explicit"
139+
140+
specmem guidelines optimize .codex/skills/review/SKILL.md \
141+
--candidate /tmp/review-best-skill.md \
142+
--score-before 0.62 \
143+
--score-after 0.74 \
144+
--evaluator codex-rollout
145+
```
146+
147+
`--instruction` mode uses the optional OpenAI dependency and requires
148+
`OPENAI_API_KEY`. It accepts changed candidates that pass static checks without
149+
regressing. `--candidate` mode accepts only when the candidate improves the
150+
provided scores, or the static score when no scores are supplied.
151+
152+
For a complete guide, see [Optimized Skills](../user-guide/optimized-skills.md).
153+
154+
Check optimized artifact status:
155+
156+
```bash
157+
specmem guidelines optimized-status
158+
specmem guidelines optimized-status --robot
159+
```
160+
161+
Accepted optimized skills can also be written back to the source skill when you
162+
want the optimized document to become canonical:
163+
164+
```bash
165+
specmem guidelines optimize .codex/skills/review/SKILL.md \
166+
--candidate /tmp/review-best-skill.md \
167+
--score-before 0.62 \
168+
--score-after 0.74 \
169+
--write-source
170+
```
171+
172+
The command writes:
173+
174+
| File | Purpose |
175+
|------|---------|
176+
| `.specmem/skillopt/<skill>/initial_skill.md` | Source skill snapshot |
177+
| `.specmem/skillopt/<skill>/candidate_skill.md` | Candidate snapshot |
178+
| `.specmem/skillopt/<skill>/best_skill.md` | Accepted optimized skill |
179+
| `.specmem/skillopt/<skill>/evaluation_report.json` | Gate result and provenance |
180+
125181
## Output Formats
126182

127183
### Table (default)

docs/user-guide/guidelines.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ SpecMem detects and parses guidelines from:
1212
| **Cursor** | `.cursorrules` | Cursor AI rules file |
1313
| **Kiro** | `.kiro/steering/*.md` | Kiro steering files |
1414
| **Agents** | `AGENTS.md` | Generic agent instructions |
15+
| **Codex skills** | `.codex/skills/*/SKILL.md` | Task-routed procedural skills |
16+
| **Claude skills** | `.claude/skills/*/SKILL.md` | Task-routed procedural skills |
1517

1618
## Viewing Guidelines
1719

@@ -65,6 +67,31 @@ View full content of a guideline:
6567
specmem guidelines show <guideline-id>
6668
```
6769

70+
Score and promote an optimized skill candidate:
71+
72+
```bash
73+
specmem guidelines score-skill .codex/skills/review/SKILL.md
74+
75+
specmem guidelines optimize .codex/skills/review/SKILL.md \
76+
--instruction "tighten this for code review tasks and make retrieval keywords explicit"
77+
78+
specmem guidelines optimize .codex/skills/review/SKILL.md \
79+
--candidate /tmp/review-best-skill.md \
80+
--score-before 0.62 \
81+
--score-after 0.74 \
82+
--evaluator codex-rollout
83+
```
84+
85+
Accepted optimized skills are stored under `.specmem/skillopt/` and are used
86+
only when building with:
87+
88+
```bash
89+
specmem build --optimize-skills
90+
```
91+
92+
See [Optimized Skills](optimized-skills.md) for the full workflow, artifact
93+
layout, and gate behavior.
94+
6895
## Converting Guidelines
6996

7097
Convert guidelines between formats to share with team members using different tools.

0 commit comments

Comments
 (0)