一键导入
populate-knowledge-base
Scan projects and docs to populate the knowledge base with verified topic files, adding only new or missing information.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Scan projects and docs to populate the knowledge base with verified topic files, adding only new or missing information.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Safely upgrade this Cortex repo to the latest template: detects on-disk state, reconciles infrastructure, and applies idempotent migrations — preserving your customizations and never overwriting your edits without asking.
Safely upgrade this Cortex workspace to the latest template: detects on-disk state, reconciles infrastructure, and applies idempotent migrations — preserving your customizations and never overwriting your edits without asking.
Maintainer auto-check for the Cortex source repo. Invoke this PROACTIVELY and automatically WHENEVER files under templates/ have been added, edited, deleted, renamed, or restructured — and before committing template changes — to classify the change as ADDITIVE (handled by the runner's reconciliation) or MIGRATION-NEEDED (breaking/structural), and scaffold a migrations/NNN-*.md if one is required. Do not wait to be asked. For use INSIDE the template source repo only; it is never shipped to user projects.
Run a full project health check across context-engineering, the knowledge base, and docs to surface gaps, drift, and inconsistencies.
Validate implementation progress of a PRP against its original requirements, auditing completed, current, and remaining phases.
Validate a generated PRP structure against its source requirements to catch gaps and misalignments before execution begins.
| name | populate-knowledge-base |
| description | Scan projects and docs to populate the knowledge base with verified topic files, adding only new or missing information. |
| disable-model-invocation | true |
Scan projects and documentation to populate the knowledge base with verified topic files.
PURPOSE: Comprehensive knowledge base population that discovers ALL relevant sources, checks what's already documented, and only adds NEW or MISSING information.
WHEN TO USE:
The knowledge base uses a concept-centric architecture:
knowledge-base/
├── INDEX.md # Master navigation
├── concepts/ # WHAT things are (definitions, schema, rules)
├── flows/ # HOW things work (processes, sequences)
├── implementations/ # WHERE code lives (patterns, file organization)
├── gotchas/ # WARNINGS (pitfalls, edge cases)
└── decisions/ # WHY we chose (ADRs)
Key principle: Separate WHAT from HOW from WHERE from WHY.
Before scanning any code, build a complete map of documentation sources.
MUST READ FIRST:
├── AGENTS.md # Agent instructions: navigation, architecture, coding standards
├── CONFIG.md # Available commands
└── context-engineering/_STATUS.md # Current project status
Identify the project:
src/)Build a complete inventory of knowledge sources:
DOCUMENTATION MAP:
├── Project Docs:
│ ├── AGENTS.md # Agent instructions: navigation, architecture, coding standards
│ └── README.md # Project overview
│
├── Documentation:
│ └── docs/ # Project documentation guides
│
├── Completed PRPs:
│ └── context-engineering/PRPs/
│ ├── {feature}.md # Simple PRPs
│ └── {FEATURE}/ # Phased PRPs
│ ├── OVERVIEW.md
│ ├── phase-*/HANDOFF.md
│ └── _STATUS.md
│
├── Archived Feature Inputs:
│ └── context-engineering/archive/feature-inputs/
│
└── Existing Knowledge Base:
└── knowledge-base/
========================================
KNOWLEDGE SOURCES DISCOVERED
========================================
Project: {project name} ({tech stack})
Documentation sources:
- AGENTS.md: Yes/No
- docs/ folder: {count} files
- Completed PRPs: {count}
- Archived feature inputs: {count}
Existing KB state:
- Concepts: {count}
- Flows: {count}
- Implementations: {count}
- Gotchas: {count}
- Decisions: {count}
========================================
Read knowledge-base/INDEX.md to understand current state.
For each section, list existing topics:
Concepts: Read knowledge-base/concepts/*.md
Flows: Read knowledge-base/flows/*.md
Implementations: Read knowledge-base/implementations/*.md
Gotchas: Read knowledge-base/gotchas/*.md
Decisions: Read knowledge-base/decisions/*.md
For each topic file, note: topic name, category, projects it covers, source PRPs, last updated date.
========================================
EXISTING KNOWLEDGE BASE STATE
========================================
Concepts: {count}
{For each: - {name}: {first sentence}}
Flows: {count}
{For each: - {name}: {first sentence}}
Implementations: {count} topics
Gotchas: {count}
{For each: - {name} [{severity}]}
Decisions: {count}
{For each: - ADR-{number}: {title}}
========================================
Compare discovered sources against existing KB.
| Knowledge Type | Goes To | Example |
|---|---|---|
| What something IS (definition, schema, rules) | concepts/ | "What is a user?" |
| HOW a process works (steps, sequence) | flows/ | "How does authentication work?" |
| Project-specific patterns | implementations/ | "How to write API routes" |
| Warnings and pitfalls | gotchas/ | "Caching issue with X" |
| Why a decision was made | decisions/ | "Why we chose X over Y" |
For each categorized item:
========================================
GAP ANALYSIS
========================================
NEW CONCEPTS NEEDED: {count}
NEW FLOWS NEEDED: {count}
NEW IMPLEMENTATIONS NEEDED: {count}
NEW GOTCHAS NEEDED: {count}
NEW DECISIONS NEEDED: {count}
UPDATES NEEDED: {count}
========================================
Organize gaps by target section.
Order by:
Output the plan and proceed unless it seems wrong.
For EACH topic to create/update:
Gather from multiple sources:
CRITICAL: Every claim must be verified against actual code.
For each piece of information:
If documentation says X but code says Y:
For each topic:
## Related section| Section | Template |
|---|---|
| concepts/ | _TEMPLATES/concept-template.md |
| flows/ | _TEMPLATES/flow-template.md |
| implementations/ | _TEMPLATES/implementation-template.md |
| gotchas/ | _TEMPLATES/gotcha-template.md |
| decisions/ | _TEMPLATES/decision-template.md |
Concepts (WHAT): Focus on definitions, schema, rules, constraints. Flows (HOW): Focus on process sequence. Include ASCII flow diagrams. Implementations (WHERE): Focus on project-specific patterns. Include actual file paths. Gotchas (WARNINGS): Be specific. Document root cause. Rate severity. Decisions (WHY): Follow ADR format. Document alternatives. Explain consequences.
feature-name.mdauthentication.md, order-lifecycle.mdGROUP-REGISTRATION-FEATURE.md, phase-3-work.mdFor each section: count topic files, find most recent date, rebuild topic table.
Count all topics across all sections. Rebuild the main index.
Confirm:
========================================
KNOWLEDGE BASE POPULATION COMPLETE
========================================
Sources scanned:
- PRPs: {count}
- Documentation files: {count}
- Code files verified: {count}
Topics created:
- Concepts: {count}
- Flows: {count}
- Implementations: {count}
- Gotchas: {count}
- Decisions: {count}
Topics updated: {count}
Topics unchanged: {count}
Final KB state:
- Total topics: {count}
Indexes regenerated: Yes
========================================
VERIFICATION SUMMARY
========================================
All claims verified against:
- Schema/migration files: {count} checked
- Type definitions: {count} checked
- Source files: {count} checked
- API routes: {count} checked
Discrepancies found: {count}
========================================