Skip to content

specmem build

Build the Agent Experience Pack and vector memory index.

Usage

specmem build [OPTIONS] [PATH]

Description

specmem build loads structured specs and agent guidance, generates embeddings, writes them to the configured vector backend, and creates the .specmem/ Agent Experience Pack.

The command uses .specmem.toml from the target repository when present.

Arguments

Argument Description Default
PATH Repository path .

Options

Option Description Default
--output, -o Output directory <PATH>/.specmem
--optimize-skills Use validated optimized skill artifacts from .specmem/skillopt when available false

Inputs

specmem build includes:

  • Structured specifications from enabled adapters, such as Kiro, Spec Kit, and Tessl
  • Agent instruction files, such as AGENTS.md, CLAUDE.md, Cursor rules, and Copilot instructions
  • Agent skills from .codex/skills/*/SKILL.md and .claude/skills/*/SKILL.md

Instruction files are pinned in memory by default. Skill files are indexed as procedural memory and selected by task intent.

Optimized skill artifacts are opt-in. Run specmem guidelines optimize to validate and promote a candidate skill, then build with --optimize-skills to index the accepted best_skill.md instead of the raw source skill. Artifacts are ignored if the source skill changed after validation.

See Optimized Skills for the full workflow.

Generated Files

File Purpose
.specmem/agent_memory.json Memory blocks with metadata
.specmem/agent_context.md Human-readable project context
.specmem/knowledge_index.json Keyword index for quick lookup
Configured vector path Embeddings for semantic retrieval

Examples

Build Current Repository

specmem build

Build Another Repository

specmem build ../service-api

Write Pack to a Custom Directory

specmem build . --output ./build/specmem

Build With Validated Optimized Skills

specmem build --optimize-skills

Build with Qdrant

Configure Qdrant in .specmem.toml:

[vectordb]
backend = "qdrant"
path = ".specmem/qdrant"
qdrant_url = "http://localhost:6333"
qdrant_collection = "specmem"

Then run:

specmem build

See Also