Skip to content

Commit 1a8bd34

Browse files
maystudiosclaude
andcommitted
feat: Phase 8+9 — self-improvement system and documentation rewrite
Phase 8 — Self-Improvement: - Add maxsim-capture-learnings.ts: Stop hook capturing session learnings to .claude/agent-memory/maxsim-learner/MEMORY.md (git log, commits) - Register in install/hooks.ts + tsdown.config.ts (6th hook bundle) - Add templates/references/self-improvement.md: Git-as-Memory, Verify+Guard, bounded iterations, stuck detection Phase 9 — Documentation: - Rewrite USER-GUIDE.md: 509 lines, all v6 commands/workflow/config - Rewrite INTERNALS.md: 572 lines, from actual source code - Update README.md: Claude Code only, 14 skills, 3 profiles, v6 config schema, correct hooks (6), remove tokenburner/multi-runtime refs - Update CONTRIBUTING.md: fix lint command, add upstream repo URL - Update GitHub templates: version 6.0.0, remove AI Runtime dropdown - Update 10 website docs: remove fictional commands/flags, fix config schema, correct plan-phase/discuss-phase titles - Add deprecation notes to context-monitor.md, multi-runtime-architecture.md Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 50090cc commit 1a8bd34

23 files changed

Lines changed: 1395 additions & 1451 deletions

‎.github/ISSUE_TEMPLATE/bug_report.yml‎

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ body:
4949
attributes:
5050
label: maxsimcli Version
5151
description: Run `npx maxsimcli@latest --version` or check your package.json
52-
placeholder: "3.10.3"
52+
placeholder: "6.0.0"
5353
validations:
5454
required: true
5555

@@ -74,20 +74,6 @@ body:
7474
validations:
7575
required: true
7676

77-
- type: dropdown
78-
id: runtime
79-
attributes:
80-
label: AI Runtime
81-
description: Which AI runtime are you installing MAXSIM into?
82-
options:
83-
- Claude Code
84-
- OpenCode
85-
- Gemini CLI
86-
- Codex
87-
- Other / Not applicable
88-
validations:
89-
required: true
90-
9177
- type: textarea
9278
id: additional
9379
attributes:

‎.github/ISSUE_TEMPLATE/feature_request.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ body:
3737
description: Which part of MAXSIM does this affect?
3838
options:
3939
- CLI / install
40-
- Commands (templates/commands/)
40+
- Commands (packages/cli/src/commands/ or templates/)
4141
- Workflows (templates/workflows/)
4242
- Agents (templates/agents/)
4343
- Dashboard

‎CONTRIBUTING.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Thank you for your interest in contributing! This guide covers everything you ne
55
## Development Setup
66

77
```bash
8-
# 1. Fork and clone the repo
8+
# 1. Fork https://github.com/maystudios/maxsimcli, then clone your fork
99
git clone https://github.com/<your-username>/maxsimcli.git
1010
cd maxsimcli
1111

@@ -75,8 +75,8 @@ git commit -m "feat!: rename STATE.md fields — breaks existing projects"
7575
This project uses **[Biome](https://biomejs.dev/)** for linting and formatting.
7676

7777
```bash
78-
npm run lint # Check
79-
npm run lint --fix # Auto-fix
78+
npm run lint # Check
79+
npm run lint -- --fix # Auto-fix (passes --fix through to Biome)
8080
```
8181

8282
Biome runs automatically on CI. PRs with lint failures will not be merged.

‎INTERNALS.md‎

Lines changed: 454 additions & 790 deletions
Large diffs are not rendered by default.

‎README.md‎

Lines changed: 101 additions & 99 deletions
Large diffs are not rendered by default.

‎docs/USER-GUIDE.md‎

Lines changed: 389 additions & 346 deletions
Large diffs are not rendered by default.

‎docs/context-monitor.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Context Window Monitor
22

3+
> **Removed in v6.** The standalone context monitor hook has been replaced by the `capture-learnings` hook, which handles end-of-session state saving without requiring a bridge file or statusline integration. This document is retained for historical reference only.
4+
5+
---
6+
37
A PostToolUse hook that warns the agent when context window usage is high.
48

59
## Problem

‎docs/multi-runtime-architecture.md‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# Multi-Runtime Adapter Architecture
22

3-
> **Status:** This document describes the multi-runtime adapter system as it existed before non-Claude runtimes were removed. It serves as a reference for future developers who might re-add multi-runtime support.
3+
> **REMOVED FEATURE — MaxsimCLI v6 supports Claude Code only.**
4+
>
5+
> This document describes the multi-runtime adapter system that was removed in v6. OpenCode, Gemini CLI, and Codex support no longer exist in the codebase. This document is retained as a reference for developers who might re-add multi-runtime support in the future. Do not rely on any of the interfaces or file paths described here — they have been deleted.
46
57
## Overview
68

‎packages/cli/README.md‎

Lines changed: 101 additions & 99 deletions
Large diffs are not rendered by default.
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
/**
2+
* Stop hook — capture session learnings into agent memory.
3+
*
4+
* Behaviour:
5+
* - Reads the Stop event JSON from stdin (includes cwd, session_id).
6+
* - Checks if a MaxsimCLI project exists in cwd (.claude/maxsim/config.json).
7+
* - If yes: reads the last 5 git commits to summarise what was done.
8+
* - Appends a dated learning entry to .claude/agent-memory/maxsim-learner/MEMORY.md.
9+
* - Creates the directory structure if it does not exist.
10+
* - Always exits 0 — never blocks the user.
11+
*/
12+
13+
import * as fs from 'node:fs';
14+
import * as path from 'node:path';
15+
import { spawnSync } from 'node:child_process';
16+
import { readStdinJson, CLAUDE_DIR } from './shared.js';
17+
18+
interface StopInput {
19+
cwd?: string;
20+
session_id?: string;
21+
stop_reason?: string;
22+
[key: string]: unknown;
23+
}
24+
25+
/** Returns true when .claude/maxsim/config.json exists in the given directory. */
26+
function isMaxsimProject(projectDir: string): boolean {
27+
try {
28+
return fs.existsSync(path.join(projectDir, CLAUDE_DIR, 'maxsim', 'config.json'));
29+
} catch {
30+
return false;
31+
}
32+
}
33+
34+
/** Reads the last N git commits as oneline strings. Returns empty array on failure. */
35+
function recentCommits(projectDir: string, n = 5): string[] {
36+
try {
37+
const result = spawnSync(
38+
'git',
39+
['log', `--oneline`, `-${n}`],
40+
{
41+
cwd: projectDir,
42+
encoding: 'utf8',
43+
timeout: 4000,
44+
stdio: ['ignore', 'pipe', 'ignore'],
45+
windowsHide: true,
46+
},
47+
);
48+
if (result.status !== 0) return [];
49+
return (result.stdout ?? '')
50+
.split('\n')
51+
.map((l) => l.trim())
52+
.filter(Boolean);
53+
} catch {
54+
return [];
55+
}
56+
}
57+
58+
/** Formats today's date as YYYY-MM-DD. */
59+
function today(): string {
60+
return new Date().toISOString().slice(0, 10);
61+
}
62+
63+
/** Appends a learning entry to the MEMORY.md file, creating dirs as needed. */
64+
function appendLearning(memoryPath: string, sessionId: string | undefined, commits: string[]): void {
65+
const dir = path.dirname(memoryPath);
66+
fs.mkdirSync(dir, { recursive: true });
67+
68+
const sessionLabel = sessionId ? ` (${sessionId.slice(0, 8)})` : '';
69+
const commitLines =
70+
commits.length > 0
71+
? commits.map((c) => `- commit: ${c}`).join('\n')
72+
: '- no commits recorded this session';
73+
74+
const entry = [
75+
`## Session ${today()}${sessionLabel}`,
76+
`- ${commits.length} commit(s) made this session`,
77+
commitLines,
78+
'',
79+
].join('\n');
80+
81+
fs.appendFileSync(memoryPath, `\n${entry}`, 'utf8');
82+
}
83+
84+
readStdinJson<StopInput>((input) => {
85+
try {
86+
const projectDir = input.cwd ?? process.cwd();
87+
88+
if (!isMaxsimProject(projectDir)) {
89+
process.exit(0);
90+
}
91+
92+
const memoryPath = path.join(
93+
projectDir,
94+
CLAUDE_DIR,
95+
'agent-memory',
96+
'maxsim-learner',
97+
'MEMORY.md',
98+
);
99+
100+
const commits = recentCommits(projectDir, 5);
101+
appendLearning(memoryPath, input.session_id, commits);
102+
} catch {
103+
// Never crash — always let the Stop event complete cleanly
104+
}
105+
106+
process.exit(0);
107+
});

0 commit comments

Comments
 (0)