create-sessions-dir 0.1.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/LICENSE +21 -0
- package/README.md +84 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +129 -0
- package/dist/index.js.map +1 -0
- package/package.json +45 -0
- package/templates/claude/commands/archive-session.md +4 -0
- package/templates/claude/commands/end-session.md +9 -0
- package/templates/claude/commands/start-session.md +8 -0
- package/templates/sessions/README.md +181 -0
- package/templates/sessions/index.md +41 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Vieko Franetovic
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# create-sessions-dir
|
|
2
|
+
|
|
3
|
+
Scaffold a Sessions Directory for working with AI coding agents.
|
|
4
|
+
|
|
5
|
+
## What is this?
|
|
6
|
+
|
|
7
|
+
`create-sessions-dir` sets up the **Sessions Directory Pattern** in your project - a workflow for maintaining context across sessions with stateless AI agents like Claude Code.
|
|
8
|
+
|
|
9
|
+
Instead of relying on the agent to "remember" previous conversations, you maintain a living document that gets read at session start and updated at session end. Simple, effective, and surprisingly powerful.
|
|
10
|
+
|
|
11
|
+
**Learn more**: [Pairing with a Partner Who Forgets Everything](https://vieko.dev/sessions)
|
|
12
|
+
|
|
13
|
+
## Quick Start
|
|
14
|
+
|
|
15
|
+
Run this in any project directory:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npx create-sessions-dir
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
This creates:
|
|
22
|
+
- `.sessions/` directory with context files
|
|
23
|
+
- `.claude/commands/` with slash commands for Claude Code
|
|
24
|
+
- Templates and workflow guide
|
|
25
|
+
|
|
26
|
+
Then start your first session:
|
|
27
|
+
```bash
|
|
28
|
+
/start-session
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## What Gets Created
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
.sessions/
|
|
35
|
+
index.md # Your living context document
|
|
36
|
+
archive/ # For completed work
|
|
37
|
+
README.md # Workflow guide and examples
|
|
38
|
+
|
|
39
|
+
.claude/
|
|
40
|
+
commands/
|
|
41
|
+
start-session.md # /start-session command
|
|
42
|
+
end-session.md # /end-session command
|
|
43
|
+
archive-session.md # /archive-session command
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Usage
|
|
47
|
+
|
|
48
|
+
### Start a Session
|
|
49
|
+
```
|
|
50
|
+
/start-session
|
|
51
|
+
```
|
|
52
|
+
Claude reads your context and asks what you want to work on.
|
|
53
|
+
|
|
54
|
+
### End a Session
|
|
55
|
+
```
|
|
56
|
+
/end-session
|
|
57
|
+
```
|
|
58
|
+
Claude updates your context with what happened and commits the changes.
|
|
59
|
+
|
|
60
|
+
### Archive Completed Work
|
|
61
|
+
```
|
|
62
|
+
/archive-session
|
|
63
|
+
```
|
|
64
|
+
Claude moves finished work to the archive to keep your context file clean.
|
|
65
|
+
|
|
66
|
+
## Requirements
|
|
67
|
+
|
|
68
|
+
- Any project (works with any language/framework)
|
|
69
|
+
- Claude Code CLI (optional but recommended for slash commands)
|
|
70
|
+
|
|
71
|
+
## Why This Works
|
|
72
|
+
|
|
73
|
+
AI coding agents are stateless - they don't remember previous sessions. The Sessions Directory Pattern solves this by:
|
|
74
|
+
|
|
75
|
+
1. **Externalizing memory** - Context lives in files, not the agent's "memory"
|
|
76
|
+
2. **Progressive documentation** - You document as you build, not after
|
|
77
|
+
3. **Continuity across sessions** - Each session starts with full context
|
|
78
|
+
4. **Proof of decisions** - Everything is written down and committed
|
|
79
|
+
|
|
80
|
+
Read the full story: [vieko.dev/sessions](https://vieko.dev/sessions)
|
|
81
|
+
|
|
82
|
+
## License
|
|
83
|
+
|
|
84
|
+
MIT © [Vieko Franetovic](https://vieko.dev)
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { existsSync, mkdirSync, writeFileSync, readFileSync } from 'fs';
|
|
3
|
+
import { join, dirname } from 'path';
|
|
4
|
+
import { fileURLToPath } from 'url';
|
|
5
|
+
import { execSync } from 'child_process';
|
|
6
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
7
|
+
const __dirname = dirname(__filename);
|
|
8
|
+
// Colors for terminal output
|
|
9
|
+
const colors = {
|
|
10
|
+
reset: '\x1b[0m',
|
|
11
|
+
bright: '\x1b[1m',
|
|
12
|
+
green: '\x1b[32m',
|
|
13
|
+
yellow: '\x1b[33m',
|
|
14
|
+
blue: '\x1b[34m',
|
|
15
|
+
cyan: '\x1b[36m',
|
|
16
|
+
};
|
|
17
|
+
function log(message, color = colors.reset) {
|
|
18
|
+
console.log(`${color}${message}${colors.reset}`);
|
|
19
|
+
}
|
|
20
|
+
function checkExistingSessions() {
|
|
21
|
+
return existsSync('.sessions');
|
|
22
|
+
}
|
|
23
|
+
function checkClaudeCLI() {
|
|
24
|
+
try {
|
|
25
|
+
execSync('which claude', { stdio: 'ignore' });
|
|
26
|
+
return true;
|
|
27
|
+
}
|
|
28
|
+
catch {
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
function getProjectName() {
|
|
33
|
+
// Try to get from package.json
|
|
34
|
+
if (existsSync('package.json')) {
|
|
35
|
+
try {
|
|
36
|
+
const pkg = JSON.parse(readFileSync('package.json', 'utf-8'));
|
|
37
|
+
if (pkg.name)
|
|
38
|
+
return pkg.name;
|
|
39
|
+
}
|
|
40
|
+
catch {
|
|
41
|
+
// Fall through
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
// Try to get from git
|
|
45
|
+
try {
|
|
46
|
+
const gitRemote = execSync('git remote get-url origin', { encoding: 'utf-8' }).trim();
|
|
47
|
+
const match = gitRemote.match(/\/([^\/]+?)(?:\.git)?$/);
|
|
48
|
+
if (match)
|
|
49
|
+
return match[1];
|
|
50
|
+
}
|
|
51
|
+
catch {
|
|
52
|
+
// Fall through
|
|
53
|
+
}
|
|
54
|
+
// Use directory name
|
|
55
|
+
return process.cwd().split('/').pop() || 'My Project';
|
|
56
|
+
}
|
|
57
|
+
function getCurrentDate() {
|
|
58
|
+
const date = new Date();
|
|
59
|
+
const options = {
|
|
60
|
+
year: 'numeric',
|
|
61
|
+
month: 'long',
|
|
62
|
+
day: 'numeric'
|
|
63
|
+
};
|
|
64
|
+
return date.toLocaleDateString('en-US', options);
|
|
65
|
+
}
|
|
66
|
+
function getTemplateContent(filename) {
|
|
67
|
+
const templatesDir = join(__dirname, '..', 'templates');
|
|
68
|
+
const filePath = join(templatesDir, filename);
|
|
69
|
+
return readFileSync(filePath, 'utf-8');
|
|
70
|
+
}
|
|
71
|
+
function createSessionsDirectory() {
|
|
72
|
+
const projectName = getProjectName();
|
|
73
|
+
const currentDate = getCurrentDate();
|
|
74
|
+
// Create directories
|
|
75
|
+
mkdirSync('.sessions', { recursive: true });
|
|
76
|
+
mkdirSync('.sessions/archive', { recursive: true });
|
|
77
|
+
mkdirSync('.claude', { recursive: true });
|
|
78
|
+
mkdirSync('.claude/commands', { recursive: true });
|
|
79
|
+
log('\n✓ Created .sessions/ directory', colors.green);
|
|
80
|
+
log('✓ Created .sessions/archive/ directory', colors.green);
|
|
81
|
+
log('✓ Created .claude/commands/ directory', colors.green);
|
|
82
|
+
// Create index.md
|
|
83
|
+
const indexContent = getTemplateContent('sessions/index.md')
|
|
84
|
+
.replace('{{PROJECT_NAME}}', projectName)
|
|
85
|
+
.replace(/\{\{CURRENT_DATE(_\d+)?\}\}/g, currentDate);
|
|
86
|
+
writeFileSync('.sessions/index.md', indexContent);
|
|
87
|
+
log('✓ Created .sessions/index.md', colors.green);
|
|
88
|
+
// Create README.md
|
|
89
|
+
const readmeContent = getTemplateContent('sessions/README.md');
|
|
90
|
+
writeFileSync('.sessions/README.md', readmeContent);
|
|
91
|
+
log('✓ Created .sessions/README.md', colors.green);
|
|
92
|
+
// Create slash commands
|
|
93
|
+
const startSessionContent = getTemplateContent('claude/commands/start-session.md');
|
|
94
|
+
writeFileSync('.claude/commands/start-session.md', startSessionContent);
|
|
95
|
+
log('✓ Created .claude/commands/start-session.md', colors.green);
|
|
96
|
+
const endSessionContent = getTemplateContent('claude/commands/end-session.md');
|
|
97
|
+
writeFileSync('.claude/commands/end-session.md', endSessionContent);
|
|
98
|
+
log('✓ Created .claude/commands/end-session.md', colors.green);
|
|
99
|
+
const archiveSessionContent = getTemplateContent('claude/commands/archive-session.md');
|
|
100
|
+
writeFileSync('.claude/commands/archive-session.md', archiveSessionContent);
|
|
101
|
+
log('✓ Created .claude/commands/archive-session.md', colors.green);
|
|
102
|
+
}
|
|
103
|
+
function main() {
|
|
104
|
+
log('\n✨ create-sessions-dir', colors.cyan + colors.bright);
|
|
105
|
+
log(' Setting up Sessions Directory Pattern\n', colors.cyan);
|
|
106
|
+
// Check for existing .sessions directory
|
|
107
|
+
if (checkExistingSessions()) {
|
|
108
|
+
log('⚠️ .sessions/ directory already exists!', colors.yellow);
|
|
109
|
+
log(' Aborting to avoid overwriting existing files.\n', colors.yellow);
|
|
110
|
+
process.exit(1);
|
|
111
|
+
}
|
|
112
|
+
// Create the structure
|
|
113
|
+
createSessionsDirectory();
|
|
114
|
+
// Check for Claude CLI
|
|
115
|
+
const hasClaudeCLI = checkClaudeCLI();
|
|
116
|
+
log('\n' + '─'.repeat(50), colors.blue);
|
|
117
|
+
log('\n🎉 Sessions Directory created successfully!\n', colors.green + colors.bright);
|
|
118
|
+
if (!hasClaudeCLI) {
|
|
119
|
+
log('⚠️ Claude CLI not detected', colors.yellow);
|
|
120
|
+
log(' Install it to use slash commands:', colors.yellow);
|
|
121
|
+
log(' npm install -g @anthropic-ai/claude-code\n', colors.cyan);
|
|
122
|
+
}
|
|
123
|
+
log('Next steps:', colors.bright);
|
|
124
|
+
log(' 1. Read the guide: .sessions/README.md');
|
|
125
|
+
log(' 2. Start your first session with: /start-session');
|
|
126
|
+
log(' 3. Learn more: https://vieko.dev/sessions\n');
|
|
127
|
+
}
|
|
128
|
+
main();
|
|
129
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AACxE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,CAAC,+CAA+C,CAAC,CAAC;AACvD,CAAC;AAED,IAAI,EAAE,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "create-sessions-dir",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Scaffold a Sessions Directory for working with AI coding agents",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"create-sessions-dir": "./dist/index.js"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"dist",
|
|
11
|
+
"templates"
|
|
12
|
+
],
|
|
13
|
+
"scripts": {
|
|
14
|
+
"build": "tsc",
|
|
15
|
+
"dev": "tsc --watch",
|
|
16
|
+
"prepublishOnly": "npm run build"
|
|
17
|
+
},
|
|
18
|
+
"keywords": [
|
|
19
|
+
"ai",
|
|
20
|
+
"claude",
|
|
21
|
+
"sessions",
|
|
22
|
+
"documentation",
|
|
23
|
+
"workflow",
|
|
24
|
+
"agent",
|
|
25
|
+
"scaffold"
|
|
26
|
+
],
|
|
27
|
+
"author": "Vieko Franetovic <hello@vieko.dev>",
|
|
28
|
+
"license": "MIT",
|
|
29
|
+
"repository": {
|
|
30
|
+
"type": "git",
|
|
31
|
+
"url": "https://github.com/vieko/create-sessions-dir.git"
|
|
32
|
+
},
|
|
33
|
+
"bugs": {
|
|
34
|
+
"url": "https://github.com/vieko/create-sessions-dir/issues"
|
|
35
|
+
},
|
|
36
|
+
"homepage": "https://github.com/vieko/create-sessions-dir#readme",
|
|
37
|
+
"dependencies": {
|
|
38
|
+
"prompts": "^2.4.2"
|
|
39
|
+
},
|
|
40
|
+
"devDependencies": {
|
|
41
|
+
"@types/node": "^22.10.2",
|
|
42
|
+
"@types/prompts": "^2.4.9",
|
|
43
|
+
"typescript": "^5.7.2"
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
# Sessions Directory Pattern
|
|
2
|
+
|
|
3
|
+
This directory implements the **Sessions Directory Pattern** for working with AI coding agents like Claude Code.
|
|
4
|
+
|
|
5
|
+
## What is this?
|
|
6
|
+
|
|
7
|
+
The Sessions Directory Pattern creates continuity across sessions with stateless AI agents. Instead of the agent trying to remember context, you maintain a living document that gets read at the start of each session and updated at the end.
|
|
8
|
+
|
|
9
|
+
**Learn more**: [Pairing with a Partner Who Forgets Everything](https://vieko.dev/sessions)
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Quick Start
|
|
14
|
+
|
|
15
|
+
### 1. Start a Session
|
|
16
|
+
|
|
17
|
+
Use the slash command:
|
|
18
|
+
```
|
|
19
|
+
/start-session
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Or prompt Claude directly:
|
|
23
|
+
> "Read .sessions/index.md and report when ready. Summarize the current state and ask what I want to work on."
|
|
24
|
+
|
|
25
|
+
### 2. Work Together
|
|
26
|
+
|
|
27
|
+
As you work, document important decisions, architecture choices, and progress:
|
|
28
|
+
> "Add this to .sessions/index.md under Current State"
|
|
29
|
+
> "Document this API decision in .sessions/"
|
|
30
|
+
|
|
31
|
+
### 3. End the Session
|
|
32
|
+
|
|
33
|
+
Use the slash command:
|
|
34
|
+
```
|
|
35
|
+
/end-session
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Or prompt Claude directly:
|
|
39
|
+
> "Update .sessions/index.md with what we accomplished this session. Include today's date, what we built, any decisions made, and next priorities. Then commit the changes."
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## Workflow
|
|
44
|
+
|
|
45
|
+
```
|
|
46
|
+
┌─────────────────────────────────────────────────┐
|
|
47
|
+
│ Start Session │
|
|
48
|
+
│ → Read .sessions/index.md │
|
|
49
|
+
│ → Understand current context │
|
|
50
|
+
│ → Ask what to work on │
|
|
51
|
+
└─────────────────────────────────────────────────┘
|
|
52
|
+
↓
|
|
53
|
+
┌─────────────────────────────────────────────────┐
|
|
54
|
+
│ During Session │
|
|
55
|
+
│ → Build features │
|
|
56
|
+
│ → Make decisions │
|
|
57
|
+
│ → Document as you go │
|
|
58
|
+
└─────────────────────────────────────────────────┘
|
|
59
|
+
↓
|
|
60
|
+
┌─────────────────────────────────────────────────┐
|
|
61
|
+
│ End Session │
|
|
62
|
+
│ → Update .sessions/index.md │
|
|
63
|
+
│ → Record what happened │
|
|
64
|
+
│ → Set next priorities │
|
|
65
|
+
│ → Commit changes │
|
|
66
|
+
└─────────────────────────────────────────────────┘
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
## Slash Commands
|
|
72
|
+
|
|
73
|
+
This setup includes three slash commands for Claude Code:
|
|
74
|
+
|
|
75
|
+
### `/start-session`
|
|
76
|
+
Reads your session context and gets you oriented. Claude will:
|
|
77
|
+
- Load `.sessions/index.md`
|
|
78
|
+
- Summarize current state
|
|
79
|
+
- Ask what you want to work on
|
|
80
|
+
|
|
81
|
+
### `/end-session`
|
|
82
|
+
Updates your session context with what happened. Claude will:
|
|
83
|
+
- Document accomplishments
|
|
84
|
+
- Record decisions and blockers
|
|
85
|
+
- Set next session priorities
|
|
86
|
+
- Commit the changes
|
|
87
|
+
|
|
88
|
+
### `/archive-session`
|
|
89
|
+
Archives completed work to keep your context file clean. Claude will:
|
|
90
|
+
- Move finished notes to `.sessions/archive/`
|
|
91
|
+
- Clean up completed items from index.md
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
## Conversational Prompts
|
|
96
|
+
|
|
97
|
+
Prefer typing to slash commands? Here are copy-paste prompts for each step:
|
|
98
|
+
|
|
99
|
+
### Starting a Session
|
|
100
|
+
```
|
|
101
|
+
Read .sessions/index.md and report when ready.
|
|
102
|
+
|
|
103
|
+
Summarize:
|
|
104
|
+
- Current state
|
|
105
|
+
- Recent work
|
|
106
|
+
- Next priorities
|
|
107
|
+
|
|
108
|
+
Then ask what I want to work on this session.
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### During a Session
|
|
112
|
+
```
|
|
113
|
+
Document this in .sessions/ under [section name]
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
```
|
|
117
|
+
Add this decision to .sessions/index.md: [your note]
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### Ending a Session
|
|
121
|
+
```
|
|
122
|
+
Update .sessions/index.md with what we accomplished this session.
|
|
123
|
+
|
|
124
|
+
Include:
|
|
125
|
+
- Today's date
|
|
126
|
+
- What we built/fixed/decided
|
|
127
|
+
- Any blockers or open questions
|
|
128
|
+
- Next session priorities
|
|
129
|
+
|
|
130
|
+
Then commit the changes with a descriptive message.
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### Archiving Work
|
|
134
|
+
```
|
|
135
|
+
Review completed work in .sessions/ and archive it.
|
|
136
|
+
|
|
137
|
+
Move finished session notes to .sessions/archive/ organized by date or topic.
|
|
138
|
+
Clean up .sessions/index.md by removing completed items.
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
---
|
|
142
|
+
|
|
143
|
+
## Tips
|
|
144
|
+
|
|
145
|
+
1. **Update frequently** - Don't wait until the end. Document decisions as you make them.
|
|
146
|
+
|
|
147
|
+
2. **Be specific** - "Fixed auth bug" is less useful than "Fixed token refresh race condition in AuthProvider"
|
|
148
|
+
|
|
149
|
+
3. **Track blockers** - Note what's blocking progress so the next session can pick up smoothly
|
|
150
|
+
|
|
151
|
+
4. **Commit often** - Each session should have at least one commit updating `.sessions/index.md`
|
|
152
|
+
|
|
153
|
+
5. **Archive completed work** - Once a feature is done, move detailed notes to `.sessions/archive/` to keep your index file scannable
|
|
154
|
+
|
|
155
|
+
---
|
|
156
|
+
|
|
157
|
+
## Customizing
|
|
158
|
+
|
|
159
|
+
This structure is a starting point. Adapt it to your needs:
|
|
160
|
+
|
|
161
|
+
- Add topic-specific docs (`.sessions/architecture.md`, `.sessions/api-decisions.md`)
|
|
162
|
+
- Create templates for recurring documentation
|
|
163
|
+
- Structure the archive however makes sense for your project
|
|
164
|
+
- Modify slash commands in `.claude/commands/` to match your workflow
|
|
165
|
+
|
|
166
|
+
---
|
|
167
|
+
|
|
168
|
+
## Why This Works
|
|
169
|
+
|
|
170
|
+
AI coding agents are stateless - they don't remember previous sessions. The Sessions Directory Pattern solves this by:
|
|
171
|
+
|
|
172
|
+
1. **Externalizing memory** - Context lives in files, not the agent's "memory"
|
|
173
|
+
2. **Progressive documentation** - You document as you build, not after
|
|
174
|
+
3. **Continuity across sessions** - Each session starts with full context
|
|
175
|
+
4. **Proof of decisions** - Everything is written down and committed
|
|
176
|
+
|
|
177
|
+
Read the full story: [vieko.dev/sessions](https://vieko.dev/sessions)
|
|
178
|
+
|
|
179
|
+
---
|
|
180
|
+
|
|
181
|
+
**Questions or feedback?** Open an issue at [github.com/vieko/create-sessions-dir](https://github.com/vieko/create-sessions-dir)
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# Session Context: {{PROJECT_NAME}}
|
|
2
|
+
|
|
3
|
+
**Date**: {{CURRENT_DATE}}
|
|
4
|
+
**Status**: Initial setup
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## Current State
|
|
9
|
+
|
|
10
|
+
This is your session context file. Update this document at the end of each session with:
|
|
11
|
+
- What you're working on
|
|
12
|
+
- Current progress
|
|
13
|
+
- Any decisions made
|
|
14
|
+
- Blockers or open questions
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## Recent Sessions
|
|
19
|
+
|
|
20
|
+
### Session 1 - {{CURRENT_DATE_2}}
|
|
21
|
+
**Accomplished**:
|
|
22
|
+
- Set up Sessions Directory Pattern
|
|
23
|
+
- Created initial context file
|
|
24
|
+
- Configured slash commands for Claude Code
|
|
25
|
+
|
|
26
|
+
**Next**:
|
|
27
|
+
- Start building!
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## Next Session Priorities
|
|
32
|
+
|
|
33
|
+
1. Define what you're building
|
|
34
|
+
2. Document your architecture decisions
|
|
35
|
+
3. Track progress here as you go
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## Notes
|
|
40
|
+
|
|
41
|
+
Add project-specific notes, links, or references here as needed.
|