Pick any line to see why it is the way it is: the commit, the pull request and issue it came from, and what the agent was thinking.
| Docs: a workspace knowledge base people and agents write together | 1 | /** |
| 2 | * The page templates g1t ships. A workspace saves its own beside them (the | |
| 3 | * `templates` table). Each is Markdown, so a template is also what an | |
| 4 | * agent asked to "write up a postmortem" starts from. Pure. | |
| 5 | */ | |
| 6 | import type { DocTemplate } from "@g1t/contracts"; | |
| 7 | ||
| 8 | const builtin = (id: string, name: string, icon: string, description: string, markdown: string): DocTemplate => ({ | |
| 9 | id: `builtin:${id}`, | |
| 10 | name, | |
| 11 | icon, | |
| 12 | description, | |
| 13 | builtin: true, | |
| 14 | markdown: markdown.trim() + "\n", | |
| 15 | created_by: null, | |
| 16 | }); | |
| 17 | ||
| 18 | export const BUILTIN_TEMPLATES: DocTemplate[] = [ | |
| 19 | builtin( | |
| 20 | "meeting-notes", | |
| 21 | "Meeting notes", | |
| 22 | "🗓️", | |
| 23 | "Who was there, what was decided, and who does what next.", | |
| 24 | ` | |
| 25 | **Date:** | |
| 26 | **Attendees:** | |
| 27 | ||
| 28 | ## Agenda | |
| 29 | ||
| 30 | - | |
| 31 | ||
| 32 | ## Notes | |
| 33 | ||
| 34 | - | |
| 35 | ||
| 36 | ## Decisions | |
| 37 | ||
| 38 | - | |
| 39 | ||
| 40 | ## Action items | |
| 41 | ||
| 42 | - [ ] | |
| 43 | `, | |
| 44 | ), | |
| 45 | builtin( | |
| 46 | "rfc", | |
| 47 | "Spec / RFC", | |
| 48 | "📐", | |
| 49 | "A proposal to review: the problem, the design, and what else was considered.", | |
| 50 | ` | |
| 51 | > [!NOTE] | |
| 52 | > **Status:** Draft · **Author:** · **Reviewers:** | |
| 53 | ||
| 54 | ## Summary | |
| 55 | ||
| 56 | One paragraph: what this proposes and why. | |
| 57 | ||
| 58 | ## Problem | |
| 59 | ||
| 60 | What is wrong or missing today, and who it hurts. | |
| 61 | ||
| 62 | ## Goals | |
| 63 | ||
| 64 | - | |
| 65 | ||
| 66 | ## Non-goals | |
| 67 | ||
| 68 | - | |
| 69 | ||
| 70 | ## Design | |
| 71 | ||
| 72 | How it works. Diagrams welcome: | |
| 73 | ||
| 74 | \`\`\`mermaid | |
| 75 | flowchart LR | |
| 76 | A[Request] --> B[Service] --> C[(Store)] | |
| 77 | \`\`\` | |
| 78 | ||
| 79 | ## Alternatives considered | |
| 80 | ||
| 81 | - | |
| 82 | ||
| 83 | ## Rollout | |
| 84 | ||
| 85 | - | |
| 86 | ||
| 87 | ## Open questions | |
| 88 | ||
| 89 | - | |
| 90 | `, | |
| 91 | ), | |
| 92 | builtin( | |
| 93 | "decision", | |
| 94 | "Decision record", | |
| 95 | "⚖️", | |
| 96 | "One decision, its context and its consequences, so nobody asks again.", | |
| 97 | ` | |
| 98 | > [!NOTE] | |
| 99 | > **Status:** Proposed · **Date:** · **Deciders:** | |
| 100 | ||
| 101 | ## Context | |
| 102 | ||
| 103 | What forces are at play. | |
| 104 | ||
| 105 | ## Decision | |
| 106 | ||
| 107 | What we will do. | |
| 108 | ||
| 109 | ## Options | |
| 110 | ||
| 111 | | Option | Pros | Cons | | |
| 112 | | --- | --- | --- | | |
| 113 | | | | | | |
| 114 | ||
| 115 | ## Consequences | |
| 116 | ||
| 117 | What becomes easier, and what becomes harder. | |
| 118 | `, | |
| 119 | ), | |
| 120 | builtin( | |
| 121 | "runbook", | |
| 122 | "Runbook", | |
| 123 | "🧰", | |
| 124 | "Steps for when something breaks, written for whoever is on call at 3am.", | |
| 125 | ` | |
| 126 | > [!WARNING] | |
| 127 | > Use this when: | |
| 128 | ||
| 129 | ## Symptoms | |
| 130 | ||
| 131 | - | |
| 132 | ||
| 133 | ## Check | |
| 134 | ||
| 135 | 1. | |
| 136 | ||
| 137 | ## Fix | |
| 138 | ||
| 139 | 1. | |
| 140 | ||
| 141 | ## Escalate | |
| 142 | ||
| 143 | Who to call, and when. | |
| 144 | ||
| 145 | ## Background | |
| 146 | ||
| 147 | Dashboards, logs and the code involved. | |
| 148 | `, | |
| 149 | ), | |
| 150 | builtin( | |
| 151 | "onboarding", | |
| 152 | "Onboarding", | |
| 153 | "👋", | |
| 154 | "A new teammate's first week: people, tools, and a first task.", | |
| 155 | ` | |
| 156 | Welcome! This page gets you from zero to your first change. | |
| 157 | ||
| 158 | ## Your first day | |
| 159 | ||
| 160 | - [ ] Get access to the workspace and its channels | |
| 161 | - [ ] Meet your onboarding buddy | |
| 162 | - [ ] Read how we work | |
| 163 | ||
| 164 | ## Your first week | |
| 165 | ||
| 166 | - [ ] Set up your machine | |
| 167 | - [ ] Ship a small change | |
| 168 | ||
| 169 | ## People to know | |
| 170 | ||
| 171 | | Who | Ask them about | | |
| 172 | | --- | --- | | |
| 173 | | | | | |
| 174 | ||
| 175 | ## Useful links | |
| 176 | ||
| 177 | - | |
| 178 | `, | |
| 179 | ), | |
| 180 | builtin( | |
| 181 | "project-brief", | |
| 182 | "Project brief", | |
| 183 | "🎯", | |
| 184 | "Why a project exists, what done looks like, and who is on it.", | |
| 185 | ` | |
| 186 | ## Why | |
| 187 | ||
| 188 | The problem, and why now. | |
| 189 | ||
| 190 | ## What done looks like | |
| 191 | ||
| 192 | - | |
| 193 | ||
| 194 | ## Scope | |
| 195 | ||
| 196 | **In:** | |
| 197 | ||
| 198 | **Out:** | |
| 199 | ||
| 200 | ## Team | |
| 201 | ||
| 202 | | Role | Who | | |
| 203 | | --- | --- | | |
| 204 | | Lead | | | |
| 205 | ||
| 206 | ## Milestones | |
| 207 | ||
| 208 | - [ ] | |
| 209 | ||
| 210 | ## Risks | |
| 211 | ||
| 212 | - | |
| 213 | `, | |
| 214 | ), | |
| 215 | builtin( | |
| 216 | "postmortem", | |
| 217 | "Postmortem", | |
| 218 | "🩹", | |
| 219 | "What happened, why, and what changes so it doesn't happen again. Blameless.", | |
| 220 | ` | |
| 221 | > [!CAUTION] | |
| 222 | > **Severity:** · **Duration:** · **Customers affected:** | |
| 223 | ||
| 224 | ## Summary | |
| 225 | ||
| 226 | What happened, in two sentences. | |
| 227 | ||
| 228 | ## Timeline | |
| 229 | ||
| 230 | | Time | What happened | | |
| 231 | | --- | --- | | |
| 232 | | | | | |
| 233 | ||
| 234 | ## Root cause | |
| 235 | ||
| 236 | ## What went well | |
| 237 | ||
| 238 | - | |
| 239 | ||
| 240 | ## What went badly | |
| 241 | ||
| 242 | - | |
| 243 | ||
| 244 | ## Action items | |
| 245 | ||
| 246 | - [ ] | |
| 247 | `, | |
| 248 | ), | |
| 249 | builtin( | |
| 250 | "weekly-update", | |
| 251 | "Weekly update", | |
| 252 | "📬", | |
| 253 | "What shipped, what's next, and what's in the way.", | |
| 254 | ` | |
| 255 | ## Shipped | |
| 256 | ||
| 257 | - | |
| 258 | ||
| 259 | ## In progress | |
| 260 | ||
| 261 | - | |
| 262 | ||
| 263 | ## Next week | |
| 264 | ||
| 265 | - | |
| 266 | ||
| 267 | ## Blocked | |
| 268 | ||
| 269 | - | |
| 270 | `, | |
| 271 | ), | |
| 272 | ]; | |
| 273 | ||
| 274 | export function builtinTemplate(id: string): DocTemplate | null { | |
| 275 | return BUILTIN_TEMPLATES.find((t) => t.id === id) ?? null; | |
| 276 | } |