source-command-prime
Load relevant knowledge base facts into context before starting work
- License 许可
- MIT
- 最近更新
- 2026-11-02
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- source-command-prime
- description
- Load relevant knowledge base facts into context before starting work
02 资源文件 1
- 参考文档references/review-output-template.md2.4 KB
03 SKILL.md 正文
source-command-prime
Use this skill when the user asks to run the migrated source command prime.
Command Template
BEADS Prime
CRITICAL: Run this command at the START of any investigation, planning, or implementation work to load relevant knowledge into your context.
When to Use
- Starting work on a GitHub Issue
- Beginning investigation/research
- Before writing a plan
- Before implementing changes
- When switching to a new area of the codebase
How It Works
This command queries the BEADS knowledge base for facts relevant to your current context and injects them into the conversation, ensuring you:
- Follow established patterns and rules
- Avoid known gotchas and pitfalls
- Make decisions aligned with architectural choices
- Don't repeat mistakes that have been learned from
Usage
Quick Prime (Most Common)
For general context with automatic detection:
bd prime
Prime for Specific Files
When working on specific files:
bd prime --files "src/lib/services/**/*.ts" "src/api/routes/**/*.ts"
Prime for Keywords
When working on a specific topic:
bd prime --keywords "authentication" "jwt" "security"
Prime for Work Type
When doing a specific type of work:
bd prime --work-type planning
bd prime --work-type implementation
bd prime --work-type review
bd prime --work-type debugging
Prime for Context Recovery
When resuming after context compaction or in a new session:
bd prime --work-type recovery
This loads active plan, project context, execution state, and relevant knowledge base facts. See "Context Recovery" section below.
Combined
bd prime \
--files "src/lib/services/ai-*.ts" \
--keywords "ai" "provider" "openai" \
--work-type implementation
What Gets Loaded
1. MUST FOLLOW (Critical Rules)
Non-negotiable rules containing NEVER/ALWAYS/MUST:
- "NEVER use
as anytype casting" - "ALWAYS use centralized AI config"
- Security-critical patterns
2. GOTCHAS (Common Pitfalls)
Known issues to avoid:
- "Truthy check fails for explicit zero values - use !== undefined"
- API behavior quirks
3. PATTERNS (Best Practices)
Established patterns in this codebase:
- "Use mock factories from test utilities"
- "Services should follow TDD (Red-Green-Refactor)"
4. DECISIONS (Architectural Choices)
Team/architectural decisions:
- "State management uses Zustand + TanStack Query"
- "AI providers implement Strategy Pattern"
5. API BEHAVIORS
External API quirks:
- "Prisma findMany returns [] not null"
Auto-Priming
The BEADS system should auto-prime in these scenarios:
- Session Start: When
.beads/directory is detected - File Touch: When reading/editing files that match knowledge patterns
- Keyword Detection: When task description matches known topics
Integration Points
In Planning Phase
Before writing a plan, run:
bd prime --work-type planning --keywords "<task-keywords>"
In Implementation Phase
Before writing code, run:
bd prime --files "<files-to-touch>" --work-type implementation
In Review Phase
Before reviewing code, run:
bd prime --work-type review --files "<files-changed>"
Manual Knowledge Check
If you need to check for specific knowledge:
# Search for specific topic
cat .beads/knowledge/*.jsonl | jq -r 'select(.fact | test("authentication"; "i")) | .fact'
# Get all gotchas
cat .beads/knowledge/gotchas.jsonl | jq -r '.fact'
# Get all patterns
cat .beads/knowledge/patterns.jsonl | jq -r '.fact'
Output Format
The prime command outputs formatted knowledge that looks like:
# Relevant Knowledge Base Facts
_25 facts loaded for this context_
## MUST FOLLOW (Critical Rules)
These are non-negotiable rules:
- **[pattern]** NEVER use `as any` type casting...
- **[security]** Always validate JWT tokens server-side...
## GOTCHAS (Common Pitfalls)
Avoid these known issues:
- **[gotcha]** Truthy check fails for explicit zero values...
## PATTERNS (Best Practices)
- **[pattern]** Use mock factories from test utilities...
Context Recovery
When --work-type recovery is used (or when an orchestrator detects it lost context), the prime command loads additional context beyond the standard knowledge base:
What Gets Loaded
- Active Plan — reads
.beads/plans/active-plan.mdif it exists withstatus: in-progress - Project Context — reads
.beads/context/project-context.md(completed work units, established patterns, tooling) - Execution State — reads
.beads/context/execution-state.md(current work unit, phase, retry count) - Standard Knowledge — all the usual MUST FOLLOW, GOTCHAS, PATTERNS, DECISIONS facts
Recovery Flow
# 1. Check for active execution
if [ -f .beads/plans/active-plan.md ]; then
grep -q 'status: in-progress' .beads/plans/active-plan.md && echo "ACTIVE PLAN FOUND"
fi
# 2. Load all context files
cat .beads/plans/active-plan.md # The approved plan
cat .beads/context/project-context.md # Completed work, patterns
cat .beads/context/execution-state.md # Where we left off
# 3. Load relevant knowledge base facts
cat .beads/knowledge/*.jsonl | jq -r '.fact'
When Recovery Triggers Automatically
- Orchestrated execution starts and finds
.beads/plans/active-plan.mdwithstatus: in-progressbut has no plan in its current context - A new session begins with
bd primeand active execution state is detected - After context compaction, when the agent recognizes it has lost plan/execution context
Output Format (Recovery Mode)
# Context Recovery
_Recovered from BEADS persisted state_
## Active Plan
<plan summary — title, work unit count, current position>
## Execution State
- Current work unit: WU-<id> (<title>)
- Phase: <IMPLEMENT|VALIDATE|REVIEW|COMMIT>
- Completed: <N> of <total> work units
## Project Context
<tooling, completed work units, established patterns>
## Relevant Knowledge
<standard priming output: MUST FOLLOW, GOTCHAS, PATTERNS, DECISIONS>
Verification
After priming, you should be able to answer:
- What are the critical rules I must follow?
- What gotchas should I watch out for?
- What patterns should I apply?
- What architectural decisions constrain my options?
- (If recovery mode) Where did execution stop and what comes next?
04 同仓库更多 Skills
clarify-requirements
Resolve genuine pre-execution ambiguity by scanning repo context, generating 1-6 grounded options, and asking 1-3 focused questions via AskUserQuestion. NOT for mid-task use (injection risk); NOT when the goal is already unambiguous; use to disambiguate vague prompts before any file edits.
openmm-md
Run FREE, open-source, Windows-native GPU molecular dynamics via the openmm-md MCP (OpenMM + CUDA on the local NVIDIA GPU). Use for protein / protein-ligand MD when you want a free stack or are on Windows without a Schrodinger license. Covers the full workflow (prepare, solvate, minimize, equilibrate, production, analyze, mmgbsa) AND an honest decision guide vs Schrodinger Desmond, including how to run Desmond legitimately on Linux or a cloud GPU with a real license. This is a deliberately LESSER free alternative and does NOT replace the schrodinger MCP tools. Do NOT use it to pick a free tool when a validated FEP+, WaterMap, IFD-MD, or Prime MM-GBSA result is actually required.
visual-review
Take screenshots of web pages and UI using Playwright for visual review and iteration
status
Diagnostic status report — shows metaswarm installation state, project setup, and potential issues
start
Use when starting work on any task, when the user mentions metaswarm, or when the user wants to begin tracked development work
setup
Interactive project setup — detects your project, configures metaswarm, writes project-local files