prelude-context 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +354 -0
- package/dist/bin/prelude.d.ts +3 -0
- package/dist/bin/prelude.d.ts.map +1 -0
- package/dist/bin/prelude.js +35 -0
- package/dist/bin/prelude.js.map +1 -0
- package/dist/src/commands/decision.d.ts +3 -0
- package/dist/src/commands/decision.d.ts.map +1 -0
- package/dist/src/commands/decision.js +74 -0
- package/dist/src/commands/decision.js.map +1 -0
- package/dist/src/commands/export.d.ts +3 -0
- package/dist/src/commands/export.d.ts.map +1 -0
- package/dist/src/commands/export.js +132 -0
- package/dist/src/commands/export.js.map +1 -0
- package/dist/src/commands/init.d.ts +3 -0
- package/dist/src/commands/init.d.ts.map +1 -0
- package/dist/src/commands/init.js +80 -0
- package/dist/src/commands/init.js.map +1 -0
- package/dist/src/commands/share.d.ts +3 -0
- package/dist/src/commands/share.d.ts.map +1 -0
- package/dist/src/commands/share.js +133 -0
- package/dist/src/commands/share.js.map +1 -0
- package/dist/src/commands/watch.d.ts +3 -0
- package/dist/src/commands/watch.d.ts.map +1 -0
- package/dist/src/commands/watch.js +58 -0
- package/dist/src/commands/watch.js.map +1 -0
- package/dist/src/constants.d.ts +16 -0
- package/dist/src/constants.d.ts.map +1 -0
- package/dist/src/constants.js +49 -0
- package/dist/src/constants.js.map +1 -0
- package/dist/src/core/exporter.d.ts +4 -0
- package/dist/src/core/exporter.d.ts.map +1 -0
- package/dist/src/core/exporter.js +196 -0
- package/dist/src/core/exporter.js.map +1 -0
- package/dist/src/core/infer.d.ts +6 -0
- package/dist/src/core/infer.d.ts.map +1 -0
- package/dist/src/core/infer.js +900 -0
- package/dist/src/core/infer.js.map +1 -0
- package/dist/src/core/updater.d.ts +8 -0
- package/dist/src/core/updater.d.ts.map +1 -0
- package/dist/src/core/updater.js +120 -0
- package/dist/src/core/updater.js.map +1 -0
- package/dist/src/core/watcher.d.ts +15 -0
- package/dist/src/core/watcher.d.ts.map +1 -0
- package/dist/src/core/watcher.js +119 -0
- package/dist/src/core/watcher.js.map +1 -0
- package/dist/src/schema/architecture.d.ts +75 -0
- package/dist/src/schema/architecture.d.ts.map +1 -0
- package/dist/src/schema/architecture.js +24 -0
- package/dist/src/schema/architecture.js.map +1 -0
- package/dist/src/schema/constraints.d.ts +146 -0
- package/dist/src/schema/constraints.d.ts.map +1 -0
- package/dist/src/schema/constraints.js +39 -0
- package/dist/src/schema/constraints.js.map +1 -0
- package/dist/src/schema/decisions.d.ts +122 -0
- package/dist/src/schema/decisions.d.ts.map +1 -0
- package/dist/src/schema/decisions.js +23 -0
- package/dist/src/schema/decisions.js.map +1 -0
- package/dist/src/schema/index.d.ts +7 -0
- package/dist/src/schema/index.d.ts.map +1 -0
- package/dist/src/schema/index.js +7 -0
- package/dist/src/schema/index.js.map +1 -0
- package/dist/src/schema/project.d.ts +69 -0
- package/dist/src/schema/project.d.ts.map +1 -0
- package/dist/src/schema/project.js +24 -0
- package/dist/src/schema/project.js.map +1 -0
- package/dist/src/schema/session.d.ts +210 -0
- package/dist/src/schema/session.d.ts.map +1 -0
- package/dist/src/schema/session.js +26 -0
- package/dist/src/schema/session.js.map +1 -0
- package/dist/src/schema/stack.d.ts +58 -0
- package/dist/src/schema/stack.d.ts.map +1 -0
- package/dist/src/schema/stack.js +23 -0
- package/dist/src/schema/stack.js.map +1 -0
- package/dist/src/utils/fs.d.ts +10 -0
- package/dist/src/utils/fs.d.ts.map +1 -0
- package/dist/src/utils/fs.js +63 -0
- package/dist/src/utils/fs.js.map +1 -0
- package/dist/src/utils/log.d.ts +20 -0
- package/dist/src/utils/log.d.ts.map +1 -0
- package/dist/src/utils/log.js +45 -0
- package/dist/src/utils/log.js.map +1 -0
- package/dist/src/utils/time.d.ts +5 -0
- package/dist/src/utils/time.d.ts.map +1 -0
- package/dist/src/utils/time.js +33 -0
- package/dist/src/utils/time.js.map +1 -0
- package/package.json +64 -0
- package/schemas/architecture.schema.json +98 -0
- package/schemas/constraints.schema.json +161 -0
- package/schemas/decisions.schema.json +95 -0
- package/schemas/export.schema.json +46 -0
- package/schemas/project.schema.json +102 -0
- package/schemas/session.schema.json +101 -0
- package/schemas/stack.schema.json +103 -0
- package/spec.md +717 -0
package/spec.md
ADDED
|
@@ -0,0 +1,717 @@
|
|
|
1
|
+
# The Prelude Specification v1.0
|
|
2
|
+
|
|
3
|
+
**Status:** Draft
|
|
4
|
+
**Last Updated:** November 2025
|
|
5
|
+
**Authors:** Rob Hocking (Adjective)
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Abstract
|
|
10
|
+
|
|
11
|
+
Prelude is an open standard for expressing and maintaining machine-readable context about a codebase. This specification defines the structure, format, and semantics of the `.context/` directory format, enabling AI tools, agents, and teams to reason about codebases with continuity, precision, and shared understanding.
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## Table of Contents
|
|
16
|
+
|
|
17
|
+
1. [Introduction](#introduction)
|
|
18
|
+
2. [Design Principles](#design-principles)
|
|
19
|
+
3. [Directory Structure](#directory-structure)
|
|
20
|
+
4. [File Specifications](#file-specifications)
|
|
21
|
+
5. [Schema Definitions](#schema-definitions)
|
|
22
|
+
6. [Versioning](#versioning)
|
|
23
|
+
7. [Validation](#validation)
|
|
24
|
+
8. [Extension Points](#extension-points)
|
|
25
|
+
9. [Security Considerations](#security-considerations)
|
|
26
|
+
10. [Implementations](#implementations)
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## 1. Introduction
|
|
31
|
+
|
|
32
|
+
### 1.1 Purpose
|
|
33
|
+
|
|
34
|
+
Modern software development increasingly involves AI-assisted coding, automated agents, and distributed teams. These systems require structured, machine-readable context about codebases to function effectively. Prelude provides a standardized format for this context.
|
|
35
|
+
|
|
36
|
+
### 1.2 Goals
|
|
37
|
+
|
|
38
|
+
- **Portability:** Context travels with the codebase
|
|
39
|
+
- **Discoverability:** Agents can find and parse context without prior knowledge
|
|
40
|
+
- **Versioning:** Context evolves alongside code
|
|
41
|
+
- **Extensibility:** Teams can add custom metadata
|
|
42
|
+
- **Simplicity:** Human-readable JSON and Markdown files
|
|
43
|
+
|
|
44
|
+
### 1.3 Non-Goals
|
|
45
|
+
|
|
46
|
+
- Replacing documentation
|
|
47
|
+
- Code generation
|
|
48
|
+
- Dependency management
|
|
49
|
+
- Build system integration
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
## 2. Design Principles
|
|
54
|
+
|
|
55
|
+
### 2.1 Local-First
|
|
56
|
+
|
|
57
|
+
All Prelude files MUST be stored locally in the repository. No external services are required for basic functionality.
|
|
58
|
+
|
|
59
|
+
### 2.2 Human-Readable
|
|
60
|
+
|
|
61
|
+
All files SHOULD be in JSON or Markdown format, easily readable by developers without special tools.
|
|
62
|
+
|
|
63
|
+
### 2.3 Version-Controlled
|
|
64
|
+
|
|
65
|
+
The `.context/` directory SHOULD be committed to version control alongside source code.
|
|
66
|
+
|
|
67
|
+
### 2.4 Incremental Adoption
|
|
68
|
+
|
|
69
|
+
Projects MAY implement partial Prelude support. Not all files are required.
|
|
70
|
+
|
|
71
|
+
### 2.5 Tool-Agnostic
|
|
72
|
+
|
|
73
|
+
This specification is implementation-independent. Multiple tools can read and write Prelude files.
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
## 3. Directory Structure
|
|
78
|
+
|
|
79
|
+
### 3.1 Standard Structure
|
|
80
|
+
|
|
81
|
+
```
|
|
82
|
+
.context/
|
|
83
|
+
├── project.json # Project metadata (REQUIRED)
|
|
84
|
+
├── stack.json # Technology stack (REQUIRED)
|
|
85
|
+
├── architecture.json # Codebase architecture (RECOMMENDED)
|
|
86
|
+
├── constraints.json # Development constraints (RECOMMENDED)
|
|
87
|
+
├── decisions.json # Architectural decisions log (RECOMMENDED)
|
|
88
|
+
├── session.json # AI interaction sessions (OPTIONAL)
|
|
89
|
+
├── changelog.md # Human-readable changelog (OPTIONAL)
|
|
90
|
+
├── export.md # LLM-optimized export (GENERATED)
|
|
91
|
+
├── export.json # Machine-readable export (GENERATED)
|
|
92
|
+
└── .watchlog.json # File change events (GENERATED)
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### 3.2 File Status
|
|
96
|
+
|
|
97
|
+
- **REQUIRED:** Must be present for valid Prelude implementation
|
|
98
|
+
- **RECOMMENDED:** Should be present for complete context
|
|
99
|
+
- **OPTIONAL:** May be present based on use case
|
|
100
|
+
- **GENERATED:** Created by tools, not manually edited
|
|
101
|
+
|
|
102
|
+
### 3.3 Reserved Names
|
|
103
|
+
|
|
104
|
+
The following filenames are reserved and MUST NOT be used for custom files:
|
|
105
|
+
- `project.json`
|
|
106
|
+
- `stack.json`
|
|
107
|
+
- `architecture.json`
|
|
108
|
+
- `constraints.json`
|
|
109
|
+
- `decisions.json`
|
|
110
|
+
- `session.json`
|
|
111
|
+
- `export.md`
|
|
112
|
+
- `export.json`
|
|
113
|
+
- `.watchlog.json`
|
|
114
|
+
|
|
115
|
+
Custom files MAY be added with different names.
|
|
116
|
+
|
|
117
|
+
---
|
|
118
|
+
|
|
119
|
+
## 4. File Specifications
|
|
120
|
+
|
|
121
|
+
### 4.1 Common Fields
|
|
122
|
+
|
|
123
|
+
All JSON files SHOULD include:
|
|
124
|
+
|
|
125
|
+
```json
|
|
126
|
+
{
|
|
127
|
+
"$schema": "https://adjective.us/prelude/schemas/v1/[filename].schema.json",
|
|
128
|
+
"version": "1.0.0",
|
|
129
|
+
...
|
|
130
|
+
}
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
- **$schema:** URI pointing to the JSON Schema for validation
|
|
134
|
+
- **version:** Semantic version of the Prelude format used
|
|
135
|
+
|
|
136
|
+
### 4.2 project.json
|
|
137
|
+
|
|
138
|
+
**Purpose:** Core metadata about the project.
|
|
139
|
+
|
|
140
|
+
**Required Fields:**
|
|
141
|
+
- `name` (string): Project name
|
|
142
|
+
- `description` (string): Brief project description
|
|
143
|
+
- `createdAt` (string): ISO 8601 datetime
|
|
144
|
+
- `updatedAt` (string): ISO 8601 datetime
|
|
145
|
+
|
|
146
|
+
**Optional Fields:**
|
|
147
|
+
- `version` (string): Project version
|
|
148
|
+
- `repository` (string): Repository URL
|
|
149
|
+
- `license` (string): License identifier
|
|
150
|
+
- `homepage` (string): Project homepage URL
|
|
151
|
+
- `team` (array): Team members
|
|
152
|
+
- `outputs` (array): Project deliverables
|
|
153
|
+
- `goals` (array): Project objectives
|
|
154
|
+
- `constraints` (array): High-level constraints
|
|
155
|
+
|
|
156
|
+
**Example:**
|
|
157
|
+
|
|
158
|
+
```json
|
|
159
|
+
{
|
|
160
|
+
"$schema": "https://adjective.us/prelude/schemas/v1/project.schema.json",
|
|
161
|
+
"version": "1.0.0",
|
|
162
|
+
"name": "my-app",
|
|
163
|
+
"description": "A modern web application",
|
|
164
|
+
"createdAt": "2025-01-01T00:00:00Z",
|
|
165
|
+
"updatedAt": "2025-01-15T12:00:00Z",
|
|
166
|
+
"projectVersion": "2.1.0",
|
|
167
|
+
"repository": "https://github.com/org/my-app",
|
|
168
|
+
"license": "MIT",
|
|
169
|
+
"team": [
|
|
170
|
+
{
|
|
171
|
+
"name": "Jane Doe",
|
|
172
|
+
"role": "Tech Lead",
|
|
173
|
+
"email": "jane@example.com"
|
|
174
|
+
}
|
|
175
|
+
]
|
|
176
|
+
}
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
### 4.3 stack.json
|
|
180
|
+
|
|
181
|
+
**Purpose:** Technology stack and dependencies.
|
|
182
|
+
|
|
183
|
+
**Required Fields:**
|
|
184
|
+
- `language` (string): Primary programming language
|
|
185
|
+
|
|
186
|
+
**Optional Fields:**
|
|
187
|
+
- `runtime` (string): Runtime environment
|
|
188
|
+
- `packageManager` (enum): Package manager (npm, pnpm, yarn, bun, pip, poetry, cargo, go)
|
|
189
|
+
- `framework` (string): Primary framework
|
|
190
|
+
- `frameworks` (array): All frameworks used
|
|
191
|
+
- `dependencies` (object): Production dependencies
|
|
192
|
+
- `devDependencies` (object): Development dependencies
|
|
193
|
+
- `buildTools` (array): Build and bundler tools
|
|
194
|
+
- `testingFrameworks` (array): Testing tools
|
|
195
|
+
- `styling` (array): Styling solutions
|
|
196
|
+
- `database` (string): Database(s) used
|
|
197
|
+
- `orm` (string): ORM/query builder
|
|
198
|
+
- `stateManagement` (string): State management solution
|
|
199
|
+
- `deployment` (string): Deployment platform
|
|
200
|
+
- `cicd` (array): CI/CD tools
|
|
201
|
+
|
|
202
|
+
**Example:**
|
|
203
|
+
|
|
204
|
+
```json
|
|
205
|
+
{
|
|
206
|
+
"$schema": "https://adjective.us/prelude/schemas/v1/stack.schema.json",
|
|
207
|
+
"version": "1.0.0",
|
|
208
|
+
"language": "TypeScript/JavaScript",
|
|
209
|
+
"runtime": "Node.js 20.x",
|
|
210
|
+
"packageManager": "pnpm",
|
|
211
|
+
"framework": "Next.js",
|
|
212
|
+
"frameworks": ["Next.js", "React"],
|
|
213
|
+
"dependencies": {
|
|
214
|
+
"next": "14.0.0",
|
|
215
|
+
"react": "18.2.0"
|
|
216
|
+
},
|
|
217
|
+
"buildTools": ["Turborepo", "esbuild"],
|
|
218
|
+
"testingFrameworks": ["Vitest", "Playwright"],
|
|
219
|
+
"styling": ["Tailwind CSS"],
|
|
220
|
+
"database": "PostgreSQL",
|
|
221
|
+
"orm": "Drizzle ORM",
|
|
222
|
+
"deployment": "Vercel",
|
|
223
|
+
"cicd": ["GitHub Actions"]
|
|
224
|
+
}
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
### 4.4 architecture.json
|
|
228
|
+
|
|
229
|
+
**Purpose:** Codebase structure and patterns.
|
|
230
|
+
|
|
231
|
+
**Optional Fields:**
|
|
232
|
+
- `type` (enum): Project type (monolith, monorepo, microservices, library, cli, fullstack, backend, frontend)
|
|
233
|
+
- `directories` (array): Key directories with metadata
|
|
234
|
+
- `patterns` (array): Architectural patterns used
|
|
235
|
+
- `conventions` (array): Code conventions
|
|
236
|
+
- `entryPoints` (array): Application entry points
|
|
237
|
+
- `routing` (enum): Routing style (file-based, config-based, none)
|
|
238
|
+
- `stateManagement` (string): State management approach
|
|
239
|
+
- `apiStyle` (enum): API style (REST, GraphQL, tRPC, gRPC, mixed, none)
|
|
240
|
+
- `dataFlow` (string): Data flow description
|
|
241
|
+
|
|
242
|
+
**Example:**
|
|
243
|
+
|
|
244
|
+
```json
|
|
245
|
+
{
|
|
246
|
+
"$schema": "https://adjective.us/prelude/schemas/v1/architecture.schema.json",
|
|
247
|
+
"version": "1.0.0",
|
|
248
|
+
"type": "monorepo",
|
|
249
|
+
"routing": "file-based",
|
|
250
|
+
"apiStyle": "tRPC",
|
|
251
|
+
"directories": [
|
|
252
|
+
{
|
|
253
|
+
"path": "apps/web",
|
|
254
|
+
"purpose": "Next.js frontend application",
|
|
255
|
+
"fileCount": 156
|
|
256
|
+
},
|
|
257
|
+
{
|
|
258
|
+
"path": "packages/db",
|
|
259
|
+
"purpose": "Database schema and migrations"
|
|
260
|
+
}
|
|
261
|
+
],
|
|
262
|
+
"patterns": [
|
|
263
|
+
"Component-based architecture",
|
|
264
|
+
"Custom hooks pattern",
|
|
265
|
+
"Service layer"
|
|
266
|
+
],
|
|
267
|
+
"conventions": [
|
|
268
|
+
"Prettier code formatting",
|
|
269
|
+
"ESLint code linting",
|
|
270
|
+
"TypeScript strict mode"
|
|
271
|
+
],
|
|
272
|
+
"entryPoints": [
|
|
273
|
+
{
|
|
274
|
+
"file": "apps/web/src/app/page.tsx",
|
|
275
|
+
"purpose": "Main application entry"
|
|
276
|
+
}
|
|
277
|
+
]
|
|
278
|
+
}
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
### 4.5 constraints.json
|
|
282
|
+
|
|
283
|
+
**Purpose:** Development rules and preferences.
|
|
284
|
+
|
|
285
|
+
**Optional Fields:**
|
|
286
|
+
- `mustUse` (array): Required technologies/practices
|
|
287
|
+
- `mustNotUse` (array): Prohibited technologies/practices
|
|
288
|
+
- `preferences` (array): Preferred approaches with rationale
|
|
289
|
+
- `codeStyle` (object): Code style configuration
|
|
290
|
+
- `naming` (object): Naming conventions
|
|
291
|
+
- `fileOrganization` (array): File organization rules
|
|
292
|
+
- `testing` (object): Testing requirements
|
|
293
|
+
- `documentation` (object): Documentation requirements
|
|
294
|
+
- `performance` (array): Performance constraints
|
|
295
|
+
- `security` (array): Security requirements
|
|
296
|
+
- `accessibility` (array): Accessibility requirements
|
|
297
|
+
|
|
298
|
+
**Example:**
|
|
299
|
+
|
|
300
|
+
```json
|
|
301
|
+
{
|
|
302
|
+
"$schema": "https://adjective.us/prelude/schemas/v1/constraints.schema.json",
|
|
303
|
+
"version": "1.0.0",
|
|
304
|
+
"mustUse": [
|
|
305
|
+
"TypeScript for type safety",
|
|
306
|
+
"Tailwind CSS for styling"
|
|
307
|
+
],
|
|
308
|
+
"mustNotUse": [
|
|
309
|
+
"Class components (use functional components)",
|
|
310
|
+
"Default exports (use named exports)"
|
|
311
|
+
],
|
|
312
|
+
"preferences": [
|
|
313
|
+
{
|
|
314
|
+
"category": "State Management",
|
|
315
|
+
"preference": "Server components over client state",
|
|
316
|
+
"rationale": "Reduces JavaScript bundle size and improves performance"
|
|
317
|
+
}
|
|
318
|
+
],
|
|
319
|
+
"codeStyle": {
|
|
320
|
+
"formatter": "Prettier",
|
|
321
|
+
"linter": "ESLint",
|
|
322
|
+
"rules": ["eslint:recommended", "plugin:@typescript-eslint/recommended"]
|
|
323
|
+
},
|
|
324
|
+
"naming": {
|
|
325
|
+
"components": "PascalCase",
|
|
326
|
+
"files": "kebab-case",
|
|
327
|
+
"functions": "camelCase"
|
|
328
|
+
},
|
|
329
|
+
"testing": {
|
|
330
|
+
"required": true,
|
|
331
|
+
"coverage": 80,
|
|
332
|
+
"strategy": "Unit tests for logic, integration tests for features"
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
### 4.6 decisions.json
|
|
338
|
+
|
|
339
|
+
**Purpose:** Log of architectural decisions (similar to ADRs).
|
|
340
|
+
|
|
341
|
+
**Structure:**
|
|
342
|
+
|
|
343
|
+
```json
|
|
344
|
+
{
|
|
345
|
+
"$schema": "https://adjective.us/prelude/schemas/v1/decisions.schema.json",
|
|
346
|
+
"version": "1.0.0",
|
|
347
|
+
"decisions": [
|
|
348
|
+
{
|
|
349
|
+
"id": "string",
|
|
350
|
+
"timestamp": "ISO 8601 datetime",
|
|
351
|
+
"title": "string",
|
|
352
|
+
"status": "enum(proposed, accepted, rejected, deprecated, superseded)",
|
|
353
|
+
"rationale": "string",
|
|
354
|
+
"alternatives": ["array of strings"],
|
|
355
|
+
"consequences": ["array of strings"],
|
|
356
|
+
"impact": "string",
|
|
357
|
+
"author": "string",
|
|
358
|
+
"tags": ["array of strings"],
|
|
359
|
+
"references": ["array of URLs"],
|
|
360
|
+
"supersededBy": "decision id"
|
|
361
|
+
}
|
|
362
|
+
]
|
|
363
|
+
}
|
|
364
|
+
```
|
|
365
|
+
|
|
366
|
+
**Example:**
|
|
367
|
+
|
|
368
|
+
```json
|
|
369
|
+
{
|
|
370
|
+
"$schema": "https://adjective.us/prelude/schemas/v1/decisions.schema.json",
|
|
371
|
+
"version": "1.0.0",
|
|
372
|
+
"decisions": [
|
|
373
|
+
{
|
|
374
|
+
"id": "1704067200000-a7b3c9d",
|
|
375
|
+
"timestamp": "2025-01-01T00:00:00Z",
|
|
376
|
+
"title": "Adopt Server Components as default",
|
|
377
|
+
"status": "accepted",
|
|
378
|
+
"rationale": "Server Components reduce client-side JavaScript and improve performance for content-heavy pages",
|
|
379
|
+
"alternatives": [
|
|
380
|
+
"Continue with client components",
|
|
381
|
+
"Use SSR with hydration"
|
|
382
|
+
],
|
|
383
|
+
"consequences": [
|
|
384
|
+
"Need to refactor existing client components",
|
|
385
|
+
"Team needs training on new patterns"
|
|
386
|
+
],
|
|
387
|
+
"impact": "Major architectural shift affecting all new features",
|
|
388
|
+
"author": "Jane Doe",
|
|
389
|
+
"tags": ["architecture", "performance", "react"]
|
|
390
|
+
}
|
|
391
|
+
]
|
|
392
|
+
}
|
|
393
|
+
```
|
|
394
|
+
|
|
395
|
+
### 4.7 session.json
|
|
396
|
+
|
|
397
|
+
**Purpose:** Log of AI/LLM interaction sessions.
|
|
398
|
+
|
|
399
|
+
**Structure:**
|
|
400
|
+
|
|
401
|
+
```json
|
|
402
|
+
{
|
|
403
|
+
"$schema": "https://adjective.us/prelude/schemas/v1/session.schema.json",
|
|
404
|
+
"version": "1.0.0",
|
|
405
|
+
"sessions": [
|
|
406
|
+
{
|
|
407
|
+
"sessionId": "string",
|
|
408
|
+
"startedAt": "ISO 8601 datetime",
|
|
409
|
+
"endedAt": "ISO 8601 datetime (optional)",
|
|
410
|
+
"entries": [
|
|
411
|
+
{
|
|
412
|
+
"id": "string",
|
|
413
|
+
"timestamp": "ISO 8601 datetime",
|
|
414
|
+
"type": "enum(prompt, decision, refactor, debug, planning, review)",
|
|
415
|
+
"summary": "string",
|
|
416
|
+
"input": "string (optional)",
|
|
417
|
+
"output": "string (optional)",
|
|
418
|
+
"filesAffected": ["array of file paths"],
|
|
419
|
+
"outcome": "enum(success, partial, failed, pending)",
|
|
420
|
+
"tags": ["array of strings"]
|
|
421
|
+
}
|
|
422
|
+
]
|
|
423
|
+
}
|
|
424
|
+
]
|
|
425
|
+
}
|
|
426
|
+
```
|
|
427
|
+
|
|
428
|
+
### 4.8 export.md
|
|
429
|
+
|
|
430
|
+
**Purpose:** Human-readable, LLM-optimized export of all context.
|
|
431
|
+
|
|
432
|
+
**Format:** Markdown
|
|
433
|
+
|
|
434
|
+
**Structure:**
|
|
435
|
+
|
|
436
|
+
```markdown
|
|
437
|
+
# Project Context
|
|
438
|
+
|
|
439
|
+
> Generated by Prelude
|
|
440
|
+
|
|
441
|
+
---
|
|
442
|
+
|
|
443
|
+
## 📋 Project Overview
|
|
444
|
+
[Content from project.json]
|
|
445
|
+
|
|
446
|
+
## 🔧 Technology Stack
|
|
447
|
+
[Content from stack.json]
|
|
448
|
+
|
|
449
|
+
## 🏗️ Architecture
|
|
450
|
+
[Content from architecture.json]
|
|
451
|
+
|
|
452
|
+
## ⚠️ Constraints & Preferences
|
|
453
|
+
[Content from constraints.json]
|
|
454
|
+
|
|
455
|
+
## 🧠 Key Decisions
|
|
456
|
+
[Recent decisions from decisions.json]
|
|
457
|
+
|
|
458
|
+
---
|
|
459
|
+
|
|
460
|
+
*End of context export*
|
|
461
|
+
```
|
|
462
|
+
|
|
463
|
+
**This file is GENERATED** and should not be manually edited.
|
|
464
|
+
|
|
465
|
+
### 4.9 export.json
|
|
466
|
+
|
|
467
|
+
**Purpose:** Machine-readable export of all context.
|
|
468
|
+
|
|
469
|
+
**Structure:**
|
|
470
|
+
|
|
471
|
+
```json
|
|
472
|
+
{
|
|
473
|
+
"$schema": "https://adjective.us/prelude/schemas/v1/export.schema.json",
|
|
474
|
+
"version": "1.0.0",
|
|
475
|
+
"generatedAt": "ISO 8601 datetime",
|
|
476
|
+
"project": { ... },
|
|
477
|
+
"stack": { ... },
|
|
478
|
+
"architecture": { ... },
|
|
479
|
+
"constraints": { ... },
|
|
480
|
+
"decisions": { ... }
|
|
481
|
+
}
|
|
482
|
+
```
|
|
483
|
+
|
|
484
|
+
**This file is GENERATED** and should not be manually edited.
|
|
485
|
+
|
|
486
|
+
---
|
|
487
|
+
|
|
488
|
+
## 5. Schema Definitions
|
|
489
|
+
|
|
490
|
+
### 5.1 JSON Schema
|
|
491
|
+
|
|
492
|
+
All JSON files MUST validate against their respective JSON Schema definitions.
|
|
493
|
+
|
|
494
|
+
Schemas are published at:
|
|
495
|
+
```
|
|
496
|
+
https://adjective.us/prelude/schemas/v1/project.schema.json
|
|
497
|
+
https://adjective.us/prelude/schemas/v1/stack.schema.json
|
|
498
|
+
https://adjective.us/prelude/schemas/v1/architecture.schema.json
|
|
499
|
+
https://adjective.us/prelude/schemas/v1/constraints.schema.json
|
|
500
|
+
https://adjective.us/prelude/schemas/v1/decisions.schema.json
|
|
501
|
+
https://adjective.us/prelude/schemas/v1/session.schema.json
|
|
502
|
+
https://adjective.us/prelude/schemas/v1/export.schema.json
|
|
503
|
+
```
|
|
504
|
+
|
|
505
|
+
### 5.2 Validation
|
|
506
|
+
|
|
507
|
+
Implementations SHOULD validate files against schemas before reading/writing.
|
|
508
|
+
|
|
509
|
+
Validation MAY be performed:
|
|
510
|
+
- On file write
|
|
511
|
+
- On file read
|
|
512
|
+
- Via CLI command (`prelude validate`)
|
|
513
|
+
- In CI/CD pipelines
|
|
514
|
+
|
|
515
|
+
---
|
|
516
|
+
|
|
517
|
+
## 6. Versioning
|
|
518
|
+
|
|
519
|
+
### 6.1 Semantic Versioning
|
|
520
|
+
|
|
521
|
+
Prelude follows Semantic Versioning 2.0.0:
|
|
522
|
+
|
|
523
|
+
- **MAJOR:** Breaking changes to file structure or required fields
|
|
524
|
+
- **MINOR:** New optional fields or files
|
|
525
|
+
- **PATCH:** Bug fixes, clarifications, non-breaking updates
|
|
526
|
+
|
|
527
|
+
### 6.2 Version Field
|
|
528
|
+
|
|
529
|
+
All JSON files MUST include a `version` field:
|
|
530
|
+
|
|
531
|
+
```json
|
|
532
|
+
{
|
|
533
|
+
"version": "1.0.0"
|
|
534
|
+
}
|
|
535
|
+
```
|
|
536
|
+
|
|
537
|
+
### 6.3 Compatibility
|
|
538
|
+
|
|
539
|
+
Implementations MUST support files with the same MAJOR version.
|
|
540
|
+
|
|
541
|
+
Implementations SHOULD gracefully handle unknown fields (forward compatibility).
|
|
542
|
+
|
|
543
|
+
### 6.4 Migration
|
|
544
|
+
|
|
545
|
+
When MAJOR version changes occur, tools SHOULD provide migration utilities.
|
|
546
|
+
|
|
547
|
+
---
|
|
548
|
+
|
|
549
|
+
## 7. Validation
|
|
550
|
+
|
|
551
|
+
### 7.1 File Presence
|
|
552
|
+
|
|
553
|
+
A valid Prelude implementation MUST include:
|
|
554
|
+
- `.context/project.json`
|
|
555
|
+
- `.context/stack.json`
|
|
556
|
+
|
|
557
|
+
### 7.2 Schema Compliance
|
|
558
|
+
|
|
559
|
+
All JSON files MUST validate against their schemas.
|
|
560
|
+
|
|
561
|
+
### 7.3 Required Fields
|
|
562
|
+
|
|
563
|
+
Files MUST include all required fields as defined in Section 4.
|
|
564
|
+
|
|
565
|
+
### 7.4 Data Types
|
|
566
|
+
|
|
567
|
+
All fields MUST conform to their specified data types.
|
|
568
|
+
|
|
569
|
+
### 7.5 ISO 8601 Datetimes
|
|
570
|
+
|
|
571
|
+
All datetime fields MUST use ISO 8601 format with UTC timezone:
|
|
572
|
+
```
|
|
573
|
+
2025-01-15T12:00:00Z
|
|
574
|
+
```
|
|
575
|
+
|
|
576
|
+
---
|
|
577
|
+
|
|
578
|
+
## 8. Extension Points
|
|
579
|
+
|
|
580
|
+
### 8.1 Custom Fields
|
|
581
|
+
|
|
582
|
+
Implementations MAY add custom fields to any JSON file.
|
|
583
|
+
|
|
584
|
+
Custom fields SHOULD be namespaced:
|
|
585
|
+
|
|
586
|
+
```json
|
|
587
|
+
{
|
|
588
|
+
"name": "my-app",
|
|
589
|
+
"x-custom": {
|
|
590
|
+
"internalId": "12345",
|
|
591
|
+
"team": "platform"
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
```
|
|
595
|
+
|
|
596
|
+
### 8.2 Custom Files
|
|
597
|
+
|
|
598
|
+
Implementations MAY add custom files to `.context/` directory.
|
|
599
|
+
|
|
600
|
+
Custom files SHOULD use prefixes to avoid conflicts:
|
|
601
|
+
|
|
602
|
+
```
|
|
603
|
+
.context/
|
|
604
|
+
├── x-custom-data.json
|
|
605
|
+
└── org-metrics.json
|
|
606
|
+
```
|
|
607
|
+
|
|
608
|
+
### 8.3 Plugins
|
|
609
|
+
|
|
610
|
+
Implementations MAY support plugin systems for extending inference or validation.
|
|
611
|
+
|
|
612
|
+
---
|
|
613
|
+
|
|
614
|
+
## 9. Security Considerations
|
|
615
|
+
|
|
616
|
+
### 9.1 Sensitive Data
|
|
617
|
+
|
|
618
|
+
`.context/` files SHOULD NOT contain:
|
|
619
|
+
- API keys or secrets
|
|
620
|
+
- Passwords or tokens
|
|
621
|
+
- Personal identifiable information (PII)
|
|
622
|
+
- Internal network topology
|
|
623
|
+
|
|
624
|
+
### 9.2 .gitignore
|
|
625
|
+
|
|
626
|
+
If `.context/` contains generated or sensitive data, relevant files MAY be added to `.gitignore`:
|
|
627
|
+
|
|
628
|
+
```
|
|
629
|
+
.context/.watchlog.json
|
|
630
|
+
.context/session.json
|
|
631
|
+
```
|
|
632
|
+
|
|
633
|
+
### 9.3 Validation
|
|
634
|
+
|
|
635
|
+
Implementations SHOULD validate input to prevent injection attacks.
|
|
636
|
+
|
|
637
|
+
---
|
|
638
|
+
|
|
639
|
+
## 10. Implementations
|
|
640
|
+
|
|
641
|
+
### 10.1 Reference Implementation
|
|
642
|
+
|
|
643
|
+
The reference implementation is:
|
|
644
|
+
- **Name:** prelude-cli
|
|
645
|
+
- **Language:** TypeScript
|
|
646
|
+
- **Repository:** https://github.com/adjective/prelude
|
|
647
|
+
- **License:** MIT
|
|
648
|
+
|
|
649
|
+
### 10.2 Alternative Implementations
|
|
650
|
+
|
|
651
|
+
Alternative implementations are encouraged and MAY use any language or platform.
|
|
652
|
+
|
|
653
|
+
All implementations SHOULD:
|
|
654
|
+
- Validate against schemas
|
|
655
|
+
- Support version field
|
|
656
|
+
- Follow this specification
|
|
657
|
+
|
|
658
|
+
### 10.3 Certification
|
|
659
|
+
|
|
660
|
+
Future versions of this spec MAY include a certification process for implementations.
|
|
661
|
+
|
|
662
|
+
---
|
|
663
|
+
|
|
664
|
+
## Appendix A: Complete Example
|
|
665
|
+
|
|
666
|
+
```
|
|
667
|
+
.context/
|
|
668
|
+
├── project.json
|
|
669
|
+
├── stack.json
|
|
670
|
+
├── architecture.json
|
|
671
|
+
├── constraints.json
|
|
672
|
+
├── decisions.json
|
|
673
|
+
└── export.md
|
|
674
|
+
```
|
|
675
|
+
|
|
676
|
+
See reference implementation for complete examples.
|
|
677
|
+
|
|
678
|
+
---
|
|
679
|
+
|
|
680
|
+
## Appendix B: Related Standards
|
|
681
|
+
|
|
682
|
+
- **JSON Schema:** https://json-schema.org/
|
|
683
|
+
- **Semantic Versioning:** https://semver.org/
|
|
684
|
+
- **ISO 8601:** https://en.wikipedia.org/wiki/ISO_8601
|
|
685
|
+
- **Architecture Decision Records (ADRs):** https://adr.github.io/
|
|
686
|
+
|
|
687
|
+
---
|
|
688
|
+
|
|
689
|
+
## Appendix C: Changelog
|
|
690
|
+
|
|
691
|
+
### v1.0.0 (2025-01-15)
|
|
692
|
+
- Initial specification release
|
|
693
|
+
|
|
694
|
+
---
|
|
695
|
+
|
|
696
|
+
## Contributing
|
|
697
|
+
|
|
698
|
+
This specification is open source and contributions are welcome.
|
|
699
|
+
|
|
700
|
+
**Repository:** https://github.com/adjective/prelude-spec
|
|
701
|
+
|
|
702
|
+
**Process:**
|
|
703
|
+
1. Open an issue to discuss proposed changes
|
|
704
|
+
2. Submit a pull request with specification updates
|
|
705
|
+
3. Specification updates require consensus from maintainers
|
|
706
|
+
|
|
707
|
+
---
|
|
708
|
+
|
|
709
|
+
## License
|
|
710
|
+
|
|
711
|
+
This specification is licensed under CC BY 4.0.
|
|
712
|
+
|
|
713
|
+
Reference implementation (prelude-cli) is licensed under MIT.
|
|
714
|
+
|
|
715
|
+
---
|
|
716
|
+
|
|
717
|
+
**Prelude Specification v1.0 - November 2025**
|