Skip to content

Commit 787b99e

Browse files
maystudiosclaude
andcommitted
feat: spec audit updates — 16 skills, HARD-GATEs, workflow extraction, GitHub comment CRUD
- Update PROJECT.md spec: 16 skills (agent-teams added), consolidated hook table, available_skills documentation, wiki role clarified, deep research note - Add HARD-GATE blocks to planner (plan-verification) and researcher (evidence-based-findings) - Add anti-rationalization table to researcher agent - Create new agent-teams skill (409 lines) for Tier 2 coordination patterns - Split maxsim-batch from 460→119 lines, Tier 2 content moved to agent-teams - Add updateComment/deleteComment to GitHub issues module with 15 new tests - Extract loop commands into separate workflow files (improve, fix-loop, debug-loop, security-audit) - Trim loop command files to <40 lines with workflow references - Fix commit-conventions: add user-invocable: false - Fix using-maxsim: add See also: verification - Update templates.test.ts to expect 16 skills Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 2c56d87 commit 787b99e

File tree

20 files changed

+2095
-606
lines changed

20 files changed

+2095
-606
lines changed

PROJECT.md

Lines changed: 40 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ One command. Installs project-locally into `.claude/`. No global installation.
7373
├── settings.json # Claude Code settings (hooks, permissions, env)
7474
├── commands/maxsim/ # 14 slash commands (13 primary + 1 alias)
7575
├── agents/ # 4 agent definitions + AGENTS.md registry
76-
├── skills/ # 15 skill modules
76+
├── skills/ # 16 skill modules
7777
├── rules/ # Conventions + verification protocol
7878
├── maxsim/
7979
│ ├── bin/maxsim-tools.cjs # Internal CLI helper
@@ -103,7 +103,7 @@ GitHub is not optional. MaxsimCLI requires:
103103
| **Labels** | Categorize issues — 6 labels in 2 namespaces: `type:` (phase, task, bug, quick) and `maxsim:` (auto, user) |
104104
| **Issue Relations** | Native GitHub "blocked by" / "blocking" for dependency tracking |
105105
| **Issue Comments** | Store plans, research, context, summaries as structured comments |
106-
| **GitHub Wiki** | Project conventions, requirements, decisions |
106+
| **GitHub Wiki** | Project specifications, requirements, architectural decisions, conventions — long-lived reference documents (vs. Issues for active tasks) |
107107
| **GitHub Discussions** | Architecture decisions, design proposals |
108108

109109
**User-created Issues:** Users can write GitHub Issues directly. MaxsimCLI recognizes them and integrates them into the planning/execution pipeline.
@@ -237,12 +237,14 @@ When a user opens Claude Code and describes a task without using `/maxsim:`, Cla
237237

238238
### 7.1 Agent Types
239239

240-
| Agent | Role | Tools | Preloaded Skills |
241-
|-------|------|-------|------------------|
242-
| **Executor** | Implements code changes | Read, Write, Edit, Bash, Grep, Glob | handoff-contract, commit-conventions |
243-
| **Planner** | Creates plans and task breakdowns | Read, Write, Bash, Grep, Glob (permissionMode: plan) | handoff-contract, roadmap-writing |
244-
| **Researcher** | Investigates codebase and external sources | Read, Bash, Grep, Glob, WebFetch, WebSearch | handoff-contract, research |
245-
| **Verifier** | Reviews and verifies completed work | Read, Bash, Grep, Glob | handoff-contract, verification, code-review |
240+
| Agent | Role | Tools | Preloaded Skills | Available Skills |
241+
|-------|------|-------|------------------|------------------|
242+
| **Executor** | Implements code changes | Read, Write, Edit, Bash, Grep, Glob | handoff-contract, commit-conventions | github-operations (trigger: GitHub Issues), tdd (trigger: test-first) |
243+
| **Planner** | Creates plans and task breakdowns | Read, Write, Bash, Grep, Glob (permissionMode: plan) | handoff-contract, roadmap-writing | github-operations (trigger: GitHub Issues), brainstorming (trigger: exploring approaches) |
244+
| **Researcher** | Investigates codebase and external sources | Read, Bash, Grep, Glob, WebFetch, WebSearch | handoff-contract, research | github-operations (trigger: GitHub Issues) |
245+
| **Verifier** | Reviews and verifies completed work | Read, Bash, Grep, Glob | handoff-contract, verification, code-review | systematic-debugging (trigger: test failures), github-operations (trigger: posting results) |
246+
247+
**Available Skills + Trigger Pattern:** Each agent has a set of `available_skills` that Claude Code loads on-demand via semantic matching when trigger conditions are met. Unlike preloaded skills (always present in context), available skills are only injected when the agent's task context matches the trigger — keeping the context window lean while ensuring specialized capabilities are accessible when needed.
246248

247249
### 7.2 Parallelism Strategy
248250

@@ -442,7 +444,7 @@ Plan Mode is **prompt-based, not tool-enforcement-based**. A `<system-reminder>`
442444

443445
## 9. Skills
444446

445-
MaxsimCLI ships with **15 skills**, following Anthropic's skill conventions exactly.
447+
MaxsimCLI ships with **16 skills**, following Anthropic's skill conventions exactly.
446448

447449
### 9.1 Skill Format
448450

@@ -483,6 +485,7 @@ description: What it does. Use when [trigger conditions].
483485
| 13 | `using-maxsim` | User-facing | Command reference and routing table. Updated for v6 commands. |
484486
| 14 | `maxsim-simplify` | Technique | Code simplification, dead code removal, reuse improvement. |
485487
| 15 | `autoresearch` | Technique | Autonomous optimization loop with reference workflows (loop-protocol, debug, fix, security, results-logging, core-principles). Powers `/maxsim:improve`, `/maxsim:fix-loop`, `/maxsim:debug-loop`, `/maxsim:security`. |
488+
| 16 | `agent-teams` | Infrastructure | Tier 2 Agent Teams coordination: TeamCreate, SendMessage, competitive implementation, multi-reviewer, collaborative debugging patterns. |
486489

487490
### 9.3 Skill Loading
488491

@@ -549,6 +552,8 @@ MaxsimCLI improves locally per project with every session through three layers:
549552
5. **External enforcement** — the system guarantees termination, not the agent's self-awareness
550553
6. **Evidence before claims** — no completion without fresh verification (Superpowers Iron Law)
551554

555+
> **Pending: Deep Research.** The autoresearch (github.com/uditgoenka/autoresearch) and superpowers (github.com/obra/superpowers) repositories will be cloned into `docs/` for comprehensive analysis. Their Memory/Learning systems will be adopted as closely as possible. The autoresearch skill will be rewritten from scratch based on these findings. The TSV metric format in the execute workflow will be unified with autoresearch's real metrics (replacing the current binary 1/0).
556+
552557
### 11.2 Three-Layer Architecture
553558

554559
| Layer | Mechanism | Frequency | What It Does |
@@ -559,15 +564,14 @@ MaxsimCLI improves locally per project with every session through three layers:
559564

560565
### 11.3 Layer 1 — Session Memory
561566

562-
**Stop hook** (`maxsim-capture-learnings`): Fires at session end. Must be improved to:
563-
- Track only THIS session's commits (diff `session_start_commit..HEAD`, not last 5 all-time)
564-
- Extract patterns from `last_assistant_message` (available in Stop payload)
565-
- Prune MEMORY.md to stay under 180 lines (hard 200-line limit in Claude Code)
566-
- Use `stop_reason` to differentiate clean exits from crashes
567-
- Check `stop_hook_active` to prevent infinite blocking loops
568-
- Write structured entries: date, session_id, commit_count, patterns, stop_reason
567+
**Stop hook** (`maxsim-capture-learnings`): Fires at session end. Implementation:
568+
- Tracks per-session commits via `session_start_commit..HEAD` with fallback to `git log -5` when the start commit is unavailable
569+
- Extracts patterns from `last_assistant_message` using keyword prefix matching (e.g., lines starting with "learned:", "pattern:", "convention:")
570+
- Prunes MEMORY.md to 180 lines (hard 200-line limit in Claude Code)
571+
- Writes structured entries: date, session_id, commit_count, patterns, stop_reason
572+
- Checks `stop_hook_active` to prevent infinite loops (skips processing if already active)
569573

570-
**SessionStart hook** (`maxsim-session-start`, NEW): Fires at session start/resume/compact. Injects context:
574+
**SessionStart hook** (`maxsim-session-start`): Fires at session start/resume/compact. Additionally detects missing hooks and warns the user if hook registration is incomplete. Injects context:
571575
- Read `git log --oneline -20` (instant orientation)
572576
- Read first 200 lines of MEMORY.md (learned patterns)
573577
- Read last 10 TSV entries (metric trends, if file exists)
@@ -670,14 +674,18 @@ All improvements are project-local. Two projects using MaxsimCLI never interfere
670674
| Hook | Event | Purpose |
671675
|------|-------|---------|
672676
| `maxsim-statusline` | statusLine | Show current MaxsimCLI status in terminal |
673-
| `maxsim-check-update` | SessionStart | Check for new MaxsimCLI version |
677+
| `maxsim-check-update` | SessionStart | Check for new MaxsimCLI version (1h cache) |
678+
| `maxsim-session-start` | SessionStart | Inject MEMORY.md + TSV + git log context |
674679
| `maxsim-notification-sound` | Notification | Play sound when Claude asks a question |
675680
| `maxsim-stop-sound` | Stop | Play sound when Claude finishes |
676681
| `maxsim-capture-learnings` | Stop | Capture session learnings to agent memory |
682+
| `maxsim-teammate-idle` | TeammateIdle | Keep teammates working if pending tasks exist |
683+
| `maxsim-task-completed` | TaskCompleted | Run verification gates before task completion |
677684

678-
### 12.2 Agent Team Hooks
685+
### 12.2 Agent Team Hook Details
679686

680687
> Research completed 2026-03-24. Official docs: https://code.claude.com/docs/en/hooks
688+
> See §12.1 for the consolidated hook list including these hooks.
681689

682690
These hooks fire only when Agent Teams are active (Tier 2 workflows). Neither hook supports matchers — they fire for every occurrence.
683691

@@ -746,7 +754,7 @@ maxsimcli/
746754
├── templates/ # Source templates (copied to .claude/ during install)
747755
│ ├── agents/ # 4 agent definitions + AGENTS.md registry
748756
│ ├── commands/maxsim/ # 14 slash commands (13 primary + 1 alias)
749-
│ ├── skills/ # 15 skill modules
757+
│ ├── skills/ # 16 skill modules
750758
│ ├── workflows/ # Workflow definitions
751759
│ ├── references/ # Reference documents
752760
│ ├── rules/ # Conventions + verification
@@ -866,7 +874,9 @@ MaxsimCLI is successful when:
866874
5. src/github/labels.ts — Label taxonomy (6 labels in 2 namespaces: type + maxsim) ✅ [UPDATE CODE: reduce from 19 to 6]
867875
6. src/github/comments.ts — Structured comments (HTML markers) ✅
868876
7. src/github/types.ts — GitHub-specific types ✅
869-
8. Tests: unit tests with mocked Octokit, E2E with real API
877+
8. src/github/discussions.ts — Discussions CRUD (GraphQL, pagination)
878+
9. src/github/wiki.ts — Wiki page management (git clone strategy)
879+
10. Tests: unit tests with mocked Octokit, E2E with real API
870880
REMOVED: mapping.ts (local cache contradicts GitHub-only principle)
871881
REMOVED: sync.ts (no sync needed — GitHub is always authoritative)
872882
REMOVED: commands.ts (functionality covered by client.ts + individual modules)
@@ -903,10 +913,12 @@ REMOVED: commands.ts (functionality covered by client.ts + individual modules)
903913
- Correct Agent tool spawn syntax
904914
3. Tests: frontmatter parsing, workflow references
905915
```
916+
Loop commands (improve, fix-loop, debug-loop, security) will be extracted into separate workflow files for consistency with other commands. execute.md will be split into sub-workflows (wave execution, competitive mode, retry loop).
917+
906918
**Commit:** `feat: commands and workflows (GitHub-first, correct tool names)`
907919
908-
### Phase 5: Skills (15 total)
909-
**Goal:** 15 skills following Anthropic conventions exactly.
920+
### Phase 5: Skills (16 total)
921+
**Goal:** 16 skills following Anthropic conventions exactly.
910922
**Spec:** `docs/spec/skills-specification.md`, `docs/spec/skills-writing-guide.md`
911923
```
912924
1. Keep 8: tdd, systematic-debugging, brainstorming, roadmap-writing,
@@ -915,11 +927,12 @@ REMOVED: commands.ts (functionality covered by client.ts + individual modules)
915927
3. New 2: project-memory, using-maxsim (updated)
916928
4. Keep 1: maxsim-simplify
917929
5. All with correct YAML frontmatter (name, description)
918-
6. All under 500 lines
919-
7. No @ imports
920-
8. Third-person descriptions
930+
6. New: agent-teams (Tier 2 coordination patterns, extracted from maxsim-batch)
931+
7. All under 500 lines
932+
8. No @ imports
933+
9. Third-person descriptions
921934
```
922-
**Commit:** `feat: 15 skills (Anthropic-compliant)`
935+
**Commit:** `feat: 16 skills (Anthropic-compliant)`
923936
924937
### Phase 6: Agents (4 definitions)
925938
**Goal:** 4 agent definitions with valid YAML frontmatter.

packages/cli/src/github/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export {
2323
// Issues
2424
export {
2525
listIssues, createIssue, getIssue, updateIssue,
26-
listComments, addComment, addSubIssue, listSubIssues, closeIssue,
26+
listComments, addComment, updateComment, deleteComment, addSubIssue, listSubIssues, closeIssue,
2727
addIssueRelation, removeIssueRelation, listIssueRelations,
2828
createEscalationIssue,
2929
} from './issues.js';

packages/cli/src/github/issues.ts

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,54 @@ export async function addComment(
217217
});
218218
}
219219

220+
/** Update an existing comment on an issue. */
221+
export async function updateComment(
222+
commentId: number,
223+
body: string,
224+
repo?: RepoInfo,
225+
): Promise<GhResult<GhComment>> {
226+
return withGhResult(async () => {
227+
const octokit = getOctokit();
228+
const { owner, repo: repoName } = repo ?? getRepoInfo();
229+
const { data } = await octokit.rest.issues.updateComment({
230+
owner,
231+
repo: repoName,
232+
comment_id: commentId,
233+
body,
234+
});
235+
return {
236+
id: data.id,
237+
nodeId: data.node_id,
238+
body: data.body ?? '',
239+
user: {
240+
login: data.user?.login ?? '',
241+
id: data.user?.id ?? 0,
242+
nodeId: data.user?.node_id ?? '',
243+
type: (data.user?.type ?? 'User') as 'User' | 'Organization',
244+
},
245+
createdAt: data.created_at,
246+
updatedAt: data.updated_at,
247+
htmlUrl: data.html_url,
248+
};
249+
});
250+
}
251+
252+
/** Delete a comment on an issue. */
253+
export async function deleteComment(
254+
commentId: number,
255+
repo?: RepoInfo,
256+
): Promise<GhResult<void>> {
257+
return withGhResult(async () => {
258+
const octokit = getOctokit();
259+
const { owner, repo: repoName } = repo ?? getRepoInfo();
260+
await octokit.rest.issues.deleteComment({
261+
owner,
262+
repo: repoName,
263+
comment_id: commentId,
264+
});
265+
});
266+
}
267+
220268
/** Add a sub-issue to a parent issue. Uses internal numeric IDs. */
221269
export async function addSubIssue(
222270
parentNumber: number,
@@ -406,7 +454,7 @@ export async function listIssueRelations(
406454
}
407455

408456
// biome-ignore lint/suspicious/noExplicitAny: Octokit REST type lacks .graphql(); cast required
409-
const data = await (octokit as any).graphql<GraphQLResponse>(query, {
457+
const data: GraphQLResponse = await (octokit as any).graphql(query, {
410458
owner,
411459
repo: repoName,
412460
number: issueNumber,

0 commit comments

Comments
 (0)