Knowledge Priming Refiner
Purpose
This refiner facilitates a structured conversation to create a project-specific knowledge base document. The document captures the project's identity -- its tech stack, architecture, directory layout, and the trusted sources that shaped how the team works. Think of it as answering one question: "What does AI need to know about this project to avoid defaulting to generic internet patterns?"
This is not about how to write good code -- that is handled by the clean-code atom (coding principles), architecture atom (structural rules), and domain-driven-design atom (domain modeling). Knowledge priming covers what those skills cannot know: which framework, which version, which docs to trust, and how the repo is organized.
What This Produces
- Output:
.lattice/standards/knowledge-base.md (or custom path from .lattice/config.yaml -> paths.knowledge_base)
- Mode: Override is the standard approach -- every project's knowledge base is unique, so there are no generic defaults to overlay on. Overlay mode is available for selective revisions of an existing document.
- Config key:
paths.knowledge_base in .lattice/config.yaml
- Template: Read
./assets/template.md for the full document structure and interview guidance comments
- Consumed by: The
knowledge-priming atom loads this document via config resolution and provides it as ambient project context to all skills and molecules
Scope Boundary
Knowledge priming captures project identity and technical context. It deliberately excludes concerns covered by other skills:
| Concern |
Where It Belongs |
Not In Knowledge Priming |
| Language idioms (error handling, type system, naming, testing patterns, DI) |
language-idioms document |
No language-level patterns or idioms |
| Coding style, naming principles, function design |
clean-code atom |
No code examples, no naming rules |
| Architectural layers, dependency direction |
architecture atom |
No structural rules |
| Domain modeling, aggregate design |
domain-driven-design atom |
No DDD patterns |
| Code-level anti-patterns (god functions, deep nesting) |
clean-code atom |
No coding anti-patterns |
If you find yourself writing content that teaches how to write code, it belongs in one of the atoms above, not here. Knowledge priming answers "what are we working with?" -- not "how should we write?"
Before You Begin
Check for existing documents
Before starting the interview:
- Read
.lattice/config.yaml -- does paths.knowledge_base point to a file?
- If yes, read that file. Ask the user:
- "You already have a knowledge base document. Would you like to revise it (update specific sections), start fresh (new interview), or add to it?"
- Revise: Load the existing document, walk through only the sections the user wants to change.
- Start fresh: Proceed with the full interview flow below.
- If no config or no existing document, proceed with the full interview flow.
Scan the repository
Look for signals that inform the conversation:
- package.json / Cargo.toml / go.mod / pyproject.toml: What languages, frameworks, and versions are in use?
- Directory structure: How is the project organized? Monorepo, single app, modules?
- Existing docs: README, ADRs, contributing guides, architecture docs?
- Config files: Linter configs, formatter configs, CI pipeline files -- these reveal conventions.
Share relevant findings with the user at the start: "I noticed your project uses [X framework] with [Y structure]. I'll use that as context for our conversation."
Facilitation Approach
- One section at a time. Walk through the 5 sections sequentially.
- Show examples first. For each section, explain what it captures, show a concrete example, then ask the user.
- Record the user's content, not the discussion. The output document reads as a reference.
- Encourage specificity. "Fastify 4.x" is useful; "modern framework" is not. Version numbers matter because APIs change between versions.
- Keep it lean. Target under 3 pages / ~50 lines of focused content. Every token competes for context window space.
Section-by-Section Interview Guide
Read ./assets/template.md and follow the <!-- INTERVIEW GUIDANCE: --> comments for each section.
The 5 sections
| # |
Section |
What It Captures |
| 1 |
Architecture Overview |
Big picture: what kind of application, major components, how they interact |
| 2 |
Tech Stack and Versions |
Specific technologies with version numbers, including "not X" clarifications |
| 3 |
Curated Knowledge Sources |
Official docs, trusted blogs, internal references the team relies on (5-10 max) |
| 4 |
Project Structure |
Directory layout showing where things live |
| 5 |
Project Conventions |
Brief project-specific conventions that other skills cannot infer (optional, slim) |
Cross-section awareness
| Described in |
Informs |
How |
| §1 -- Architecture |
§4 -- Project Structure |
Architecture style shapes directory layout |
| §2 -- Tech Stack |
§5 -- Project Conventions |
Stack choices may imply project-specific conventions |
| §2 -- Tech Stack |
§3 -- Curated Sources |
Each technology has authoritative docs worth curating |
Output Assembly
- YAML frontmatter:
mode: override (or overlay for selective)
- Preamble text (from template)
- All sections with the user's content
- Sections the user skipped get a
<!-- TODO: Fill in during next revision --> comment
- Strip all
<!-- INTERVIEW GUIDANCE: --> comments from the output
Determine output path:
- If
.lattice/config.yaml exists and has paths.knowledge_base, use that path.
- Otherwise, default to
.lattice/standards/knowledge-base.md.
Update config:
- If
.lattice/config.yaml does not exist, create it with paths.knowledge_base pointing to the output file.
- If it exists but lacks the key, add it. Preserve existing content.
Document Quality Checks
Before writing the final document, verify:
1---2name: knowledge-priming-refiner3description: Facilitate a structured conversation to create a project-specific knowledge base document. Produces a knowledge-base.md that primes AI with the project's tech stack, architecture, trusted sources, and project structure. Use when the user says 'set up knowledge base', 'prime the project', 'onboard AI', 'create knowledge base', 'set up project context', or 'configure AI context'.4---5
6# Knowledge Priming Refiner
7
8## Purpose
9
10This refiner facilitates a structured conversation to create a project-specific knowledge base document. The document captures the project's identity -- its tech stack, architecture, directory layout, and the trusted sources that shaped how the team works. Think of it as answering one question: "What does AI need to know about *this project* to avoid defaulting to generic internet patterns?"
11
12This is not about how to write good code -- that is handled by the `clean-code` atom (coding principles), `architecture` atom (structural rules), and `domain-driven-design` atom (domain modeling). Knowledge priming covers what those skills cannot know: which framework, which version, which docs to trust, and how the repo is organized.
13
14## What This Produces
15
16- **Output**: `.lattice/standards/knowledge-base.md` (or custom path from `.lattice/config.yaml` -> `paths.knowledge_base`)
17- **Mode**: Override is the standard approach -- every project's knowledge base is unique, so there are no generic defaults to overlay on. Overlay mode is available for selective revisions of an existing document.
18- **Config key**: `paths.knowledge_base` in `.lattice/config.yaml`
19- **Template**: Read `./assets/template.md` for the full document structure and interview guidance comments
20- **Consumed by**: The `knowledge-priming` atom loads this document via config resolution and provides it as ambient project context to all skills and molecules
21
22## Scope Boundary
23
24Knowledge priming captures **project identity and technical context**. It deliberately excludes concerns covered by other skills:
25
26| Concern | Where It Belongs | Not In Knowledge Priming |
27|---------|-----------------|--------------------------|
28| Language idioms (error handling, type system, naming, testing patterns, DI) | `language-idioms` document | No language-level patterns or idioms |
29| Coding style, naming principles, function design | `clean-code` atom | No code examples, no naming rules |
30| Architectural layers, dependency direction | `architecture` atom | No structural rules |
31| Domain modeling, aggregate design | `domain-driven-design` atom | No DDD patterns |
32| Code-level anti-patterns (god functions, deep nesting) | `clean-code` atom | No coding anti-patterns |
33
34If you find yourself writing content that teaches *how to write code*, it belongs in one of the atoms above, not here. Knowledge priming answers "what are we working with?" -- not "how should we write?"
35
36## Before You Begin
37
38### Check for existing documents
39
40Before starting the interview:
41
421. Read `.lattice/config.yaml` -- does `paths.knowledge_base` point to a file?
432. If yes, read that file. Ask the user:
44 - "You already have a knowledge base document. Would you like to **revise** it (update specific sections), **start fresh** (new interview), or **add to it**?"
45 - Revise: Load the existing document, walk through only the sections the user wants to change.
46 - Start fresh: Proceed with the full interview flow below.
473. If no config or no existing document, proceed with the full interview flow.
48
49### Scan the repository
50
51Look for signals that inform the conversation:
52
53- **package.json / Cargo.toml / go.mod / pyproject.toml**: What languages, frameworks, and versions are in use?
54- **Directory structure**: How is the project organized? Monorepo, single app, modules?
55- **Existing docs**: README, ADRs, contributing guides, architecture docs?
56- **Config files**: Linter configs, formatter configs, CI pipeline files -- these reveal conventions.
57
58Share relevant findings with the user at the start: "I noticed your project uses [X framework] with [Y structure]. I'll use that as context for our conversation."
59
60## Facilitation Approach
61
62- **One section at a time.** Walk through the 5 sections sequentially.
63- **Show examples first.** For each section, explain what it captures, show a concrete example, then ask the user.
64- **Record the user's content, not the discussion.** The output document reads as a reference.
65- **Encourage specificity.** "Fastify 4.x" is useful; "modern framework" is not. Version numbers matter because APIs change between versions.
66- **Keep it lean.** Target under 3 pages / ~50 lines of focused content. Every token competes for context window space.
67
68## Section-by-Section Interview Guide
69
70Read `./assets/template.md` and follow the `<!-- INTERVIEW GUIDANCE: -->` comments for each section.
71
72### The 5 sections
73
74| # | Section | What It Captures |
75|---|---------|-----------------|
76| 1 | **Architecture Overview** | Big picture: what kind of application, major components, how they interact |
77| 2 | **Tech Stack and Versions** | Specific technologies with version numbers, including "not X" clarifications |
78| 3 | **Curated Knowledge Sources** | Official docs, trusted blogs, internal references the team relies on (5-10 max) |
79| 4 | **Project Structure** | Directory layout showing where things live |
80| 5 | **Project Conventions** | Brief project-specific conventions that other skills cannot infer (optional, slim) |
81
82### Cross-section awareness
83
84| Described in | Informs | How |
85|-------------|---------|-----|
86| §1 -- Architecture | §4 -- Project Structure | Architecture style shapes directory layout |
87| §2 -- Tech Stack | §5 -- Project Conventions | Stack choices may imply project-specific conventions |
88| §2 -- Tech Stack | §3 -- Curated Sources | Each technology has authoritative docs worth curating |
89
90## Output Assembly
91
921. YAML frontmatter: `mode: override` (or `overlay` for selective)
932. Preamble text (from template)
943. All sections with the user's content
954. Sections the user skipped get a `<!-- TODO: Fill in during next revision -->` comment
965. Strip all `<!-- INTERVIEW GUIDANCE: -->` comments from the output
97
98**Determine output path:**
991. If `.lattice/config.yaml` exists and has `paths.knowledge_base`, use that path.
1002. Otherwise, default to `.lattice/standards/knowledge-base.md`.
101
102**Update config:**
1031. If `.lattice/config.yaml` does not exist, create it with `paths.knowledge_base` pointing to the output file.
1042. If it exists but lacks the key, add it. Preserve existing content.
105
106## Document Quality Checks
107
108Before writing the final document, verify:
109
110- [ ] Content is specific, not generic ("Fastify 4.x" not "modern framework")
111- [ ] Tech stack entries include version numbers where applicable
112- [ ] "Not X" clarifications steer AI away from common defaults that do not apply
113- [ ] Curated sources are limited to 5-10 high-value entries
114- [ ] No coding guidelines (naming rules, code examples, anti-patterns) -- those belong in other skills
115- [ ] Document stays under ~50 lines of focused content (excluding headings and formatting)
116- [ ] Would a new developer find this useful for understanding *what this project is*?
117- [ ] **Not a redirect stub** — fewer than 3 of the 5 sections populated, or body primarily points to another file → STOP before writing. Say: "This knowledge base is mostly a pointer and won't prime sessions effectively. Should we inline the key content from [referenced file] instead?" Do not write a redirect-only document.