A living knowledge base for a topic domain. This file provides AI agents with context on how to work effectively in this folder.
Core principle: Supply missing structure when safe.
The user does not need perfect prompting skill. When a request is clear enough and risk is low, you must proactively:
- Sharpen the scope if it's too vague
- Add a sensible investigation order
- Define explicit verification targets
- Choose the right execution lane
- Switch to TDD when behavior changes
Only ask questions when the gap has real consequences for safety, scope, or correctness.
From docs/core-agent-doctrine.md:
- Scope tightly — Don't ask for "everything"
- Give rich evidence — Logs, files, configs, then stop micromanaging
- Supply missing structure — Fill in what the user misses
- Define done and verification early — Success criteria matter
- Verification is learning — Testing effect strengthens reasoning
- Choose the lightest lane — Inline, reusable, isolated, review
- Plan when ambiguous — Re-plan when execution wobbles
- Optimize quality, not volume — Verification > generation
- Promote repeated work — Turn recurring workflows into assets
- Update memory after lessons — Compound, don't repeat
- Prefer simple code — Add complexity only when concrete system demand requires it
When working on complex tasks, continuously prompt yourself until you reach a plateau of conclusion.
1. Make an initial attempt
2. Prompt yourself: "What else should I consider?"
3. Prompt yourself: "Am I missing anything?"
4. Prompt yourself: "Is this complete? What would make it better?"
5. Continue until plateau
6. Present to user for review
You've reached plateau when:
- New iterations produce only minor refinements
- Your answers become consistent with previous answers
- You can articulate why you're done
Use for: Complex tasks, analysis, research, writing refinement Don't use for: Simple questions or quick tasks
This workspace follows a standardized structure:
[Topic-Folder]/
├── AGENTS.md (propagated - operating contract)
├── workspace-system-overview.md (propagated - what this project is)
├── session-state.json (propagated - current state, read first on resume)
├── topic-insights.md (propagated - your lessons)
├── git-github-best-practices.md (propagated - git conventions)
├── quality-standards.md (propagated - quality rules)
├── .cleanup-protect (propagated - cleanup protection)
├── audit-folder-quality.ps1 (propagated - quality audit)
├── check-sync-status.ps1 (propagated - sync checker)
├── sync-from-hub.ps1 (propagated - sync from hub)
├── opencode.json (propagated - tool config)
├── opencode-agent-system.md (propagated - agent instructions)
├── [topic-name]-content/ (mandatory primary operating area)
├── meta/ (optional - YOUR content, never touched by hub)
│ ├── README.md (folder purpose)
│ ├── quality-standards.md (topic-specific rules)
│ └── ... (other topic-specific files)
└── archive/ (historical records)
| File | When to Read |
|---|---|
session-state.json |
First on every resume - where you left off |
workspace-system-overview.md |
When you need to understand project structure |
AGENTS.md |
When working with AI or need operating rules |
topic-insights.md |
When you need your lessons/learnings |
Do normal project work inside [topic-name]-content/.
Use the folder root only for propagated instruction files and truly root-scoped project files. If you need to add source code, notes, assets, datasets, drafts, or project-specific docs, put them under [topic-name]-content/ unless there is a concrete tool reason they must live at the root.
Create meta/ only when durable project context is needed. This folder is NEVER touched by hub propagation — your content stays safe.
The meta/ folder is for your project-specific content that the hub should never touch:
| File | Purpose |
|---|---|
meta/README.md |
Explains this folder's purpose and structure |
meta/quality-standards.md |
Topic-specific quality rules (custom to this topic) |
meta/PROJECT.md |
Tech stack, conventions, special rules |
meta/HANDOVER.md |
(deprecated - use session-state.json instead) |
| Other files | Any project-specific notes, configs, or docs |
Key rule: Hub propagation only touches root files. The meta/ folder is yours — completely protected from overwrites.
The folder root should stay boring and sparse.
Allowed at root:
- Propagated files:
AGENTS.md,topic-insights.md,git-github-best-practices.md,.cleanup-protect,audit-folder-quality.ps1 - Optional project-control files that truly must be root-scoped, such as
.git,.gitignore,.github/,.vscode/, ormeta/ - Rare tool-required root files, only when the tool breaks if they are moved
Not allowed at root unless there is a concrete tool reason:
- source folders like
src/,app/,lib/,packages/ - notes, drafts, research, copied docs, or assignment material
- assets, datasets, downloads, archives, temp folders, logs, caches, and generated outputs
- duplicate legacy content folders
If a folder already has root drift:
- Do not add more work to the root item.
- Identify whether it is safe content, generated junk, or tool-required state.
- Move safe content into
[topic-name]-content/. - Do not move
.git, build caches, tool homes, or active project roots unless the user explicitly approves the move. - Report anything risky instead of guessing.
| Location | Type | Propagation | Protected |
|---|---|---|---|
| Root (standard files) | Templates | Yes | Yes (Managed-By marker) |
[topic-name]-content/ |
Primary operating area and actual content | Created by propagation, then project-owned | No |
meta/ |
Optional topic-specific context | No | No (no marker) |
Files with <!-- Managed-By: AI-Prompting-Library --> are system-managed:
- Propagated from central AI Prompting template
- Can be updated/merged by propagate-to-all.ps1
- Never delete these
Files without this marker are protected:
- Never overwritten by propagation
- Topic-specific content stays intact
This folder can pull the latest propagated templates from the AI Prompting hub at any time — no need to wait for the hub to push updates.
Run from this folder's root:
.\sync-from-hub.ps1Or preview changes first:
.\sync-from-hub.ps1 -Preview- Pulls latest templates from
AI Prompting/propagate-templates/ - Updates managed files (those with
Managed-Bymarker) - Skips unmanaged files (your custom content is safe)
- Creates missing files (e.g., if new templates were added to the hub)
- When you see "templates updated" in the hub's session state
- When a new template is announced
- Before starting major work (ensures you have latest conventions)
- After creating a new folder (run once to get all base files)
- Build context before editing
- Prefer root-cause fixes over symptom patches
- Use the smallest maintainable change
- Verify with closest local equivalent
- Summarize root cause, fix, verification, residual risk
- Session state on every resume — Read
session-state.jsonfirst. It contains what was being worked on and what comes next. - Checkpoint before heavy operations — Update
session-state.jsonBEFORE multi-phase work or bulk operations (seedocs/session-checkpoint.mdon the hub for the full system)
This project uses session-state.json as the shared memory place — same system as the AI Prompting hub.
Rule 1: Read session-state.json FIRST on every resume
Rule 2: Write session-state.json BEFORE heavy operations
On resume:
- Read
session-state.jsonfirst — not AGENTS.md, not other docs - Check: What's the current task? What's the status? What changed last? What's the context pressure?
Before heavy operations:
- Update
session-state.jsonwith current progress - Write BEFORE exhaustion, not after
- Include: what changed, files touched, verification, residual risk
Session state structure:
## CURRENT STATE
- Session: session-N
- Status: active/in_progress/complete
- Context pressure: low/medium/high
## CURRENT TASK
- Name: what you're working on
- Status: in_progress/complete/blocked
## WHAT CHANGED
- Add bullets about what changed this session
## FILES TOUCHED THIS SESSION
- List files modified
## VERIFICATION
- How did you verify the work?
## RESIDUAL RISK
- What's still uncertain? What could go wrong?
## NEXT ACTION
- What's the next step?- At the start of a new session (after reading)
- Before heavy operations (bulk edits, multi-phase work)
- When task status changes (started, completed, blocked)
- When context pressure increases (you're getting tired or context is getting stale)
See the hub's docs/session-checkpoint.md for full trigger conditions, context pressure signs, and workflow.
At the end of meaningful work, add a compact entry to archive/history-YYYY-MM.md (create archive/ if needed). Include: date, what changed, files touched, decisions made.
History is NOT read by default. It's for long-break resumes and understanding past decisions. The startup path is: session-state.json → AGENTS.md → task files.
Before any cleanup (deleting files, removing folders):
- Read
.cleanup-protectto see what files are protected - Check each file for
<!-- Managed-By: AI-Prompting-Library -->marker - NEVER delete any file that:
- Is listed in
.cleanup-protect - Contains the marker
Managed-By: AI-Prompting-Library
- Is listed in
AGENTS.md— Main instructions (has marker)topic-insights.md— Cross-domain insights (has marker)git-github-best-practices.md— Git conventions (has marker).cleanup-protect— This protection listaudit-folder-quality.ps1— Quality audit script- Any file with
Managed-By: AI-Prompting-Library
Insights from this topic can contribute to the central AI Prompting knowledge base:
- Add insights to
topic-insights.md - Tag with
#ai-relevant,#cross-domain, or#universal - Insights are harvested and reviewed for cross-domain relevance
- Significant insights are merged into central docs
low— Obvious, local, easy-to-verify changesmedium— Normal topic workhigh— Ambiguous debugging, cross-file changes, risky workxhigh— Broad, difficult, expensive-to-get-wrong tasks
Run the audit before and after major changes:
.\audit-folder-quality.ps1The audit validates:
- Folder organization (naming, structure)
- Script quality (parameters, help, error handling)
- Content quality (cited claims)
- Markdown quality (headings, links)
- Template completeness
When this project uses an agentic workflow system (e.g., OpenCode with .opencode/agents/), follow these rules:
- Simple tasks: One-sentence response
- Medium tasks: Bullets + code
- Complex tasks: Structured sections
- Teaching: Only when explicitly requested ("explain," "teach me")
- Suggest handoff at 10+ turns
- Compress context to 5-line summary before spawning subsession
- Detect topic shifts and spawn fresh context
Default behavior: Handle directly. The Orchestrator should handle tasks itself using available tools. Only spawn a subagent when the task clearly exceeds direct-handling thresholds.
| Situation | Handler |
|---|---|
| Simple, clear, under 10 seconds | Orchestrator (direct) |
| Complex, specialized, multi-step | Subagent (routed) |
Subagent routing (only when direct handling isn't enough):
| Subtask Type | Threshold | Route To | Default Model | When |
|---|---|---|---|---|
| Search / discovery | 10+ files, complex patterns | Explorer | M2.5 Free | Bulk search only |
| Fresh context needed | 15+ turns, topic shift, quality degradation | Worker | Same as Orchestrator (K2.6) or M2.7 | Long sessions |
| Different capabilities | 1M context, multimodal, math | Specialized model | Gemini, DeepSeek, etc. | Capability gap |
Why only 2 subagents?
- Drafter + Analyst merged into Worker — both just meant "do work with fresh context"
- Per-request cost difference is often zero now (free Sonnet 4.6, Gemini free tier, K2.6 promo)
- The real win is fresh context, not cheaper models
All other tasks — planning, docs, file ops, simple debug/review, Q&A, normal coding — should be handled directly by the Orchestrator. Only spawn when the benefit clearly exceeds the 4–8 second overhead.
Three-tier fallback:
- Tier 1 — Orchestrator direct: Handle everything directly by default. Zero extra cost.
- Tier 2 — Fresh context (Worker): Spawn @worker when context is degraded (15+ turns, topic shift). Same model, clean slate.
- Tier 3 — Escalation (Sonnet 4.6 / Opus 4.7): Only when security is suspected, main AI failed twice, or user explicitly requests premium analysis.
Cost rule: Direct handling costs $0 extra. Worker subagent costs the same as direct (same model). Escalation to premium uses Copilot quota — keep it rare.
Manual override: @explorer find X or "use K2.6 for this" bypasses routing.
Do not add public-facing footers that disclose routing, model use, or internal execution mechanics unless the target repo or platform explicitly requires it.
Keep accountability in the right place:
session-state.jsonrecords lanes, progress, files touched, verification, and residual risk.- User-facing summaries focus on root cause, fix, verification, and remaining uncertainty.
- PRs and public comments stay project-native: no routing notes, model names, or generic automation tells.
- If a repo requires disclosure, follow that repo's rule and keep it concise.
When spawning subsessions, pass only:
- Task (specific, bounded)
- Context (3-5 bullets)
- Files (paths only)
- Done when (success criteria)
Never pass: full thread history, previous reasoning chains, teaching material.
- Never downgrade critical tasks (debugging, final review)
- Verify specialist output before presenting
- If an agent misroutes 3× in a session, revert to monolithic
- User can override: "use [best model] for this" bypasses routing
- If the same fix path fails twice, checkpoint, re-plan, or switch to fresh context before more edits
For project-specific instructions (tech stack, conventions, special rules), see meta/PROJECT.md. Create this file if it does not exist — it is never overwritten by hub propagation.
Example meta/PROJECT.md:
# Project Context
## Tech Stack
- Language/framework:
- Package manager:
## Conventions
- Code style:
- Naming patterns:
## Special Rules
- Any project-specific behaviors or gotchasFor detailed guidance on specific topics:
- Teaching Order →
docs/core-agent-doctrine.md(Teaching section) - Prompt templates →
docs/prompt-templates.md - Research workflow →
docs/core-agent-doctrine.md(Research section) - Token efficiency →
docs/token-efficient-prompting.md - Model selection →
docs/model-selection-guide.md - Agentic workflows →
docs/agentic-workflows.md - Session checkpoint →
docs/session-checkpoint.md(topic folders: usesession-state.json)