A model-agnostic tool that captures AI-assisted development sessions, providing developers with clear visibility into tasks completed, concepts learned, and file changes made. The tool enables session continuity and helps developers maintain control over AI-assisted changes.
Each session summary must include:
- Tasks Completed: List of specific tasks accomplished during the session. This should be a brief summary, 5 bullet points or less if possible.
- Concepts Covered: Foundational understanding of new concepts, patterns, or technologies. If external sources have been referenced by the model, include website links, clickable links to peer-reviewed papers only if they are relevant to the topic, links to external github repos so that the developer can review the concepts themselves. Foundational knowlegde should be covered, starting from the most basic level and increasing in difficulty. No more than 10 bullet points.
- Files Read: List of files that were examined (read-only access). If no files have been read in the session, so say.
- Files Modified: Detailed changes made to files with diffs. Why were these files changed? Brief summary of the change, followed by a snapshot of the code that has been updated. If no files have been edited in the session, say so.
- Prerequisites: Information needed to continue work in future sessions
- Session Metadata: Timestamp, topic, duration, AI model used (if detectable), token count
- Markdown: Human-readable format for quick review and documentation
- JSON: Machine-readable format for programmatic parsing and tooling integration
- Sessions stored in
sessions/directory (version controlled but hidden) - Naming convention:
session-name-YYYY-MM-DD-HHMMSS.mdand.jsonwhere name is a one or two word description of the topic. - Configuration file:
config.jsonfor token thresholds and other settings
graph TD
A[Developer completes AI session] --> B[Developer: complete session summary]
B --> C[AI reads instructions from sessions/INSTRUCTIONS.md]
C --> D[AI performs self-reflection on conversation]
C --> E[AI runs git diff analysis]
D --> F[Extract tasks and concepts]
E --> G[Categorize file changes]
F --> H[Generate session summary]
G --> H
H --> I[Write markdown summary]
H --> J[Write JSON summary]
I --> K[sessions/session-TIMESTAMP.md]
J --> L[sessions/session-TIMESTAMP.json]
sessions/
├── INSTRUCTIONS.md # Instructions for AI to generate summaries
├── TEMPLATE.md # Template structure for summaries
├── schema.json # JSON schema for machine-readable output
├── config.json # Configuration for token thresholds and settings
├── .session-state.json # Current session state (token count, start time)
├── session-2026-06-04-114500.md
├── session-2026-06-04-114500.json
└── index.json # Index of all sessions
Comprehensive guide for AI models containing:
- Step-by-step process to generate session summary
- How to analyze conversation history
- Git commands to run for file change detection
- Template to follow for output
- Examples of good summaries
- Model-agnostic language (works with any AI)
Simple Node.js/Python script for:
session-summary init- Initialize session trackingsession-summary start- Mark session start (capture git state)session-summary end- Trigger summary generationsession-summary list- List all sessionssession-summary load <id>- Load previous session context
The tool will use git to:
- Detect all file changes since session start
- Generate diffs for modified files
- Identify new files created
- Track deleted files
- Distinguish between read and modified files (via AI reflection)
# AI Session Summary
**Date**: YYYY-MM-DD HH:MM:SS
**Duration**: X minutes
**AI Model**: [Model name if known]
**Token Count**: X tokens (Y% of threshold)
## Tasks Completed
- Task 1
- Task 2
## Concepts Covered
### Concept Name
Brief explanation...
## Files Accessed
### Read Only
- `path/to/file1.ts` - Purpose of reading
### Modified
- `path/to/file2.ts` - What was changed and why
### Created
- `path/to/file3.ts` - Purpose of new file
### Deleted
- `path/to/file4.ts` - Reason for deletion
## Detailed File Changes
### path/to/file2.ts
**Changes Made**: Description
**Reason**: Why these changes were necessary
```diff
[git diff output]- Context needed to continue
- Dependencies or setup required
- Current state of work
- Suggested next actions
#### JSON Structure
```json
{
"sessionId": "uuid",
"timestamp": "ISO-8601",
"duration": "minutes",
"aiModel": "string",
"tokenCount": 0,
"tokenThreshold": 100000,
"tasks": ["task1", "task2"],
"concepts": [
{
"name": "concept",
"description": "explanation"
}
],
"files": {
"read": ["path1"],
"modified": [
{
"path": "path2",
"changes": "description",
"diff": "git diff output"
}
],
"created": ["path3"],
"deleted": ["path4"]
},
"prerequisites": ["prereq1"],
"nextSteps": ["step1"]
}
When loading a previous session:
- AI reads the session summary
- Understands context and state
- Can continue work seamlessly
- References previous decisions and rationale
- Create
sessions/directory structure - Write comprehensive INSTRUCTIONS.md for AI models
- Create TEMPLATE.md with example structure
- Define JSON schema
- Document git commands for file change detection
- Create helper scripts for git diff analysis
- Test with various file change scenarios
- Test instruction file with AI model
- Generate example session summary
- Refine template based on output quality
- Add CLI tool for session management (optional)
- Create index.json for session tracking
- Add session search/filter capabilities
- Write comprehensive README
- Add usage examples
- Document best practices
- Instructions written in clear, universal language
- No model-specific APIs or features required
- Works with any AI that can read files and execute commands
- Self-contained instructions in repository
- Leverages existing version control
- Accurate file change detection
- Provides detailed diffs automatically
- No additional monitoring infrastructure needed
- Markdown for human readability and quick review
- JSON for tooling integration and automation
- Both formats contain same information
sessions/directory is tracked in git- Provides history of AI interactions
- Enables team collaboration and review
- Can be excluded via .gitignore if needed
- Clarity: Summaries clearly explain what was done and why
- Completeness: All file changes and concepts are captured
- Continuity: Future sessions can resume work seamlessly
- Model Agnostic: Works with any AI assistant
- Low Friction: Simple command to generate summary
- Useful: Provides real value for code review and understanding
To prevent context window degradation and maintain AI response quality, the tool includes token threshold monitoring. This feature helps developers know when to end a session and start fresh with a summary.
- Configuration File:
config.jsonstores token threshold settings - Session State Tracking:
.session-state.jsontracks current session token count - Manual Updates: Developer manually updates token count or uses simple estimation
- Threshold Alerts: When approaching threshold (70-80%), AI suggests creating summary
{
"tokenThreshold": 100000,
"warningThreshold": 0.7,
"criticalThreshold": 0.85,
"autoSuggestSummary": true,
"defaultModel": "gpt-4"
}{
"sessionStartTime": "ISO-8601",
"currentTokenCount": 45000,
"lastUpdated": "ISO-8601",
"sessionActive": true
}-
Session Start: Initialize with
session-summary start- Creates
.session-state.json - Records start time
- Resets token count to 0
- Creates
-
During Session: Periodic checks
- Developer can manually update:
session-summary update-tokens 50000 - Or use estimation:
session-summary estimate-tokens - Tool checks against thresholds
- Developer can manually update:
-
Threshold Warnings:
- 70% (Warning): "Consider wrapping up current task"
- 85% (Critical): "Strongly recommend creating session summary"
- 100% (Limit): "Session summary required before continuing"
-
Session End: Generate summary
- Run
session-summary endor tell AI "complete session summary" - Token count included in summary metadata
- State file archived or reset
- Run
- Approaching token threshold (70-85%)
- Completed a major feature or milestone
- Switching to a different task or context
- End of work day/session
- Before code review or PR creation
- Small Sessions (10K-30K tokens): Single feature, bug fix
- Medium Sessions (30K-70K tokens): Multiple related tasks
- Large Sessions (70K-100K tokens): Complex feature, refactoring
- Avoid: Sessions over 100K tokens (context degradation risk)
- Average message: 100-500 tokens
- Code file (500 lines): ~2000-3000 tokens
- Long conversation (20 exchanges): ~10K-20K tokens
- Use conservative estimates when unsure
- OpenAI API: Direct token count from API responses
- Anthropic API: Claude token usage tracking
- Other Models: Plugin architecture for custom integrations
- Automatic token counting via API hooks
- Real-time token usage display
- Predictive warnings based on conversation patterns
- Token usage analytics and trends
- Multi-model token tracking
- Status bar token counter
- Visual threshold indicators
- Automatic summary suggestions
- One-click session management
- Web UI for browsing sessions
- Integration with PR descriptions
- Automatic session detection via API integration
- Session comparison tool
- Export to other formats (PDF, HTML)
- Team collaboration features
- Session analytics and insights
- Real-time token monitoring with API integration
- VSCode extension for seamless integration