بنقرة واحدة
update-knowledge-base
Extract learnings from a completed PRP into the knowledge base.
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Extract learnings from a completed PRP into the knowledge base.
التثبيت باستخدام 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 | update-knowledge-base |
| description | Extract learnings from a completed PRP into the knowledge base. |
| argument-hint | <prp-path> |
| disable-model-invocation | true |
Update the knowledge base from a PRP or from the current conversation context.
PURPOSE: Extract key decisions, architectural patterns, gotchas, and changes into the knowledge base so future agents have instant access.
TWO MODES:
WHEN TO USE:
/update-knowledge-base context-engineering/PRPs/FEATURE-NAME)/update-knowledge-base)/update-knowledge-base)The knowledge base uses a concept-centric architecture:
knowledge-base/
├── INDEX.md # Master navigation (regenerated)
├── concepts/ # WHAT things are
│ └── _SUMMARY.md
├── flows/ # HOW things work
│ └── _SUMMARY.md
├── implementations/ # WHERE code lives
│ ├── _SUMMARY.md
│ └── {project-name}/ # Per-project patterns
│ └── _SUMMARY.md
├── gotchas/ # WARNINGS
│ └── _SUMMARY.md
└── decisions/ # WHY we chose (ADRs)
└── _SUMMARY.md
Key principle: Separate WHAT from HOW from WHERE from WHY.
Check if $ARGUMENTS is provided:
If argument looks like a path (contains / or ends with .md):
If no argument or argument is empty:
(Only for MODE A - PRP path provided)
OVERVIEW.md for feature summary and key decisionsHANDOFF.md from ALL completed phases (start from phase-0, work forward)FIXES.md from phases that had significant fixes_STATUS.md for current stateGather ALL significant knowledge without categorizing yet. A single feature often produces knowledge that spans multiple categories.
NOTE: Do not skip items 2-6 just because item 5 has obvious entries. Every feature touches multiple areas.
→ Continue to STEP 2
(Only for MODE B - no argument)
Review the current conversation and extract ALL raw knowledge.
For each piece of information:
Prepare:
→ Continue to STEP 2
Before categorizing, you MUST answer ALL 5 questions below. Answer each honestly — "None" is valid.
Write out your answers before proceeding:
Q1 — CONCEPT: Did this work introduce or change any entity definitions, schemas, business rules, valid states, or entity relationships? → Answer: {yes/no + brief description, or "None"}
Q2 — FLOW: Did this work create or modify any multi-step processes, data flow paths, state transitions, or sequences? → Answer: {yes/no + brief description, or "None"}
Q3 — IMPLEMENTATION: Did this work establish project-specific code patterns, file organization conventions, reusable components, or anti-patterns to avoid? → Answer: {yes/no + brief description, or "None"}
Q4 — GOTCHA: Did anything surprising happen? Bugs, edge cases, non-obvious behavior, things that broke unexpectedly? → Answer: {yes/no + brief description, or "None"}
Q5 — DECISION: Were there significant choices between alternative approaches? Trade-offs made? Architectural reasoning worth preserving? → Answer: {yes/no + brief description, or "None"}
If ALL 5 answers are "None": This work does not warrant a knowledge base update. Skip Steps 3-4, proceed to Step 5 (project docs check), and report: "Knowledge base: No new knowledge to document."
If ANY answer is "yes": Create/update topic files for EVERY "yes" answer.
| Knowledge Type | Goes To | Example |
|---|---|---|
| What something IS (definition, schema, rules, constraints) | concepts/ | "What is a user?" |
| HOW a process works (steps, sequence, data flow) | flows/ | "How does checkout work?" |
| Project-specific patterns (code examples, file org) | implementations/{project}/ | "How to write API routes in project-a" |
| Warnings and pitfalls (bugs, edge cases) | gotchas/ | "Caching issue with X" |
| Why a decision was made (alternatives, trade-offs) | decisions/ | "Why we chose X over Y" |
For each piece of knowledge extracted:
Read the relevant section's _SUMMARY.md to see existing topics.
If a topic exists that covers the same area → UPDATE it (Step 3.2) If no topic exists → CREATE one (Step 3.3)
Read the existing topic file, then apply merge rules:
All Topics:
**Last Updated:** to today's date**Source PRPs:** if applicable## Changes Log with today's date, what changed, and sourceCRITICAL: Do NOT remove existing content. The knowledge base is additive.
Use the appropriate template from knowledge-base/_TEMPLATES/:
concept-template.md for conceptsflow-template.md for flowsimplementation-template.md for implementationsgotcha-template.md for gotchasdecision-template.md for decisions (ADRs)File Naming:
{descriptive-name}.mdauthentication.md, order-lifecycle.md, caching-issue.mdGROUP-REGISTRATION.md, phase-5.md, fix.mdFor Decisions (ADRs):
{NNN}-{title}.mdAfter all topic files are created/updated:
For EACH section that was modified:
.md files in the section folder (excluding _SUMMARY.md)_SUMMARY.md with correct counts and topic tables.md files (excluding _SUMMARY.md), build topic tableknowledge-base/INDEX.md with updated counts and listingsAfter updating the knowledge base, also update the project's AGENTS.md, but ONLY for durable, every-session facts (see gating below).
From the PRP or conversation context, determine which project(s) in active-projects/ were modified.
| Knowledge Type | Goes To | Examples |
|---|---|---|
| New code patterns established | Project AGENTS.md | "Always use helper_function() for X" |
| File organization changes | Project AGENTS.md | "Delete modals go in components/modals/" |
| New commands or utilities | Project AGENTS.md | "New script: npm run sync-types" |
| Anti-patterns discovered | Project AGENTS.md | "Never call X without Y" |
| Architectural decisions | Project AGENTS.md | "Events now sync via webhook pattern" |
| New data flows | Project AGENTS.md | "Record creation now triggers notification" |
| Integration points added | Project AGENTS.md | "New API endpoint /api/sync/report" |
| Data model changes | Project AGENTS.md | "Added participants table" |
NOTE: Fix logs, changelogs, per-feature narratives, phase-completion notes, and transient status must NOT go in AGENTS.md. Those belong in the PRP's own FIXES.md/COMPLETED.md and the knowledge base (gotchas/, decisions/, flows/, implementations/{project}/).
Read the project's active-projects/{project}/AGENTS.md file, then APPEND or UPDATE appropriate sections — but only for durable, every-session facts: project structure, tech stack, a build/test/lint command, a new coding convention, an "always do X / never do Y" rule, or a high-level architecture/data-flow change. Litmus test: "Would a fresh agent need this in EVERY session, regardless of the task?" If no, do not touch AGENTS.md.
Rules:
<!-- Added from PRP: {PRP-NAME}, {date} -->Not every PRP requires project doc updates. Skip if:
Document in the report: "Project docs: No significant changes to document"
========================================
KNOWLEDGE BASE & PROJECT DOCS UPDATED
========================================
Source: {PRP name OR "Conversation context: {description}"}
KNOWLEDGE BASE:
Sections touched: {list of section names}
Topics created: {count}
{For each: - {section}/{topic-name}.md}
Topics updated: {count}
{For each: - {section}/{topic-name}.md (added: {what was added})}
Index regenerated: Yes
Summaries regenerated: {list of sections}
PROJECT DOCUMENTATION:
Projects affected: {list}
{For each project:}
- {project}/AGENTS.md: {Updated sections (durable facts only) or "No changes needed"}
========================================
## Related sections