feat: add Cowork compatibility, /mode command, and make-mode skill#1309
feat: add Cowork compatibility, /mode command, and make-mode skill#1309thedotmack wants to merge 4 commits intomainfrom
Conversation
…mode skill - Add lazy session initialization in observation endpoint for Cowork environments where UserPromptSubmit hook doesn't fire - Add Python version auto-detection in ChromaMcpManager (probes 3.13→3.10) - Add matcher "*" to UserPromptSubmit hook for defense-in-depth - Add /mode slash command to list and switch modes via settings API - Add cowork.json mode with 6 knowledge-work observation types and 7 concepts - Add cowork--chill.json behavioral variant for selective recording - Add make-mode skill for guided custom mode creation Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
PR Review: feat/cowork-modes - see full review below |
Claude-Mem: AI Development InstructionsClaude-mem is a Claude Code plugin providing persistent memory across sessions. It captures tool usage, compresses observations using the Claude Agent SDK, and injects relevant context into future sessions. Architecture5 Lifecycle Hooks: SessionStart → UserPromptSubmit → PostToolUse → Summary → SessionEnd Hooks ( Worker Service ( Database ( Search Skill ( Planning Skill ( Execution Skill ( Chroma ( Viewer UI ( Privacy Tags
Implementation: Tag stripping happens at hook layer (edge processing) before data reaches worker/database. See Build Commandsnpm run build-and-sync # Build, sync to marketplace, restart workerConfigurationSettings are managed in File Locations
Exit Code StrategyClaude-mem hooks use specific exit codes per Claude Code's hook contract:
Philosophy: Worker/hook errors exit with code 0 to prevent Windows Terminal tab accumulation. The wrapper/plugin layer handles restart logic. ERROR-level logging is maintained for diagnostics. See Requirements
DocumentationPublic Docs: https://docs.claude-mem.ai (Mintlify) Pro Features ArchitectureClaude-mem is designed with a clean separation between open-source core functionality and optional Pro features. Open-Source Core (this repository):
Pro Features (coming soon, external):
This architecture preserves the open-source nature of the project while enabling sustainable development through optional paid features. ImportantNo need to edit the changelog ever, it's generated automatically. |
|
#!/usr/bin/env node /**
import { execSync } from 'child_process'; function exec(command) { function getReleases() { // Fetch body for each release return releases; function formatDate(isoDate) { function cleanReleaseBody(body) { function extractVersion(tagName) { function generateChangelog(releases) { const lines = [ // Sort releases by date (newest first) for (const release of releases) { } return lines.join('\n'); function main() { const releases = getReleases(); if (releases.length === 0) { const changelog = generateChangelog(releases); writeFileSync('CHANGELOG.md', changelog, 'utf-8'); console.log('\n✅ CHANGELOG.md generated successfully!'); main(); |
- New set-mode skill: full mode activation (settings + project instructions + worker restart) in one command - Updated make-mode skill: added Step 6 for creating mode CLAUDE.md files focused on human-primary agent relationship - Mode CLAUDE.md files are standalone project instructions with no claude-mem internal references - set-mode installs mode instructions via <claude-mem-mode> tags in the project's CLAUDE.md (idempotent on mode switches) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
REVIEW PART 1/4 - Bugs
|
|
REVIEW PART 2/4 - Performance and Security Performance:
Security:
|
|
REVIEW PART 3/4 - Code Quality and Nits Code Quality / Minor:
Nits:
|
|
REVIEW PART 4/4 - Overall Summary The feature set is solid and the Cowork mode design is thoughtful. The lazy session init is the most impactful fix and the core logic is clear. Main asks before merge:
Lower priority:
|
|
test |
Claude-Mem: AI Development InstructionsClaude-mem is a Claude Code plugin providing persistent memory across sessions. It captures tool usage, compresses observations using the Claude Agent SDK, and injects relevant context into future sessions. Architecture5 Lifecycle Hooks: SessionStart → UserPromptSubmit → PostToolUse → Summary → SessionEnd Hooks ( Worker Service ( Database ( Search Skill ( Planning Skill ( Execution Skill ( Chroma ( Viewer UI ( Privacy Tags
Implementation: Tag stripping happens at hook layer (edge processing) before data reaches worker/database. See Build Commandsnpm run build-and-sync # Build, sync to marketplace, restart workerConfigurationSettings are managed in File Locations
Exit Code StrategyClaude-mem hooks use specific exit codes per Claude Code's hook contract:
Philosophy: Worker/hook errors exit with code 0 to prevent Windows Terminal tab accumulation. The wrapper/plugin layer handles restart logic. ERROR-level logging is maintained for diagnostics. See Requirements
DocumentationPublic Docs: https://docs.claude-mem.ai (Mintlify) Pro Features ArchitectureClaude-mem is designed with a clean separation between open-source core functionality and optional Pro features. Open-Source Core (this repository):
Pro Features (coming soon, external):
This architecture preserves the open-source nature of the project while enabling sustainable development through optional paid features. ImportantNo need to edit the changelog ever, it's generated automatically. |
|
Review summary: Good foundational work on Cowork compatibility, Python version fallback, and mode system. Key items to address: (1) ChromaMcpManager.ts detectPythonVersion() - uses execSync synchronously, blocking the event loop up to 20s; result not memoized, re-probes all versions on every call; cache in a private field. Fallback to '3.13' still hangs - use python3 or python (unversioned) instead. (2) SessionRoutes.ts lazy init - hardcoded prompt number 1 could duplicate or misalign if UserPromptSubmit already fired; TOCTOU race between getSession and initializeSession could double-initialize under concurrent Cowork requests. (3) mode.md/set-mode SKILL.md - ARGUMENTS interpolated directly into curl JSON body; mode names with metacharacters break it; use jq with named args. (4) /mode vs /set-mode UX inconsistency - /mode says next session, /set-mode says active now; merge or clearly differentiate. (5) worker-service.cjs is a compiled artifact in the diff - confirm it was rebuilt from updated source. Minor: cowork--chill.json parent-fallback logic needs integration test; matcher wildcard in hooks.json is correct; cowork.json taxonomy is well-structured. |
|
FULL_REVIEW_ENCODED_PLACEHOLDER |
Code Review - Placeholder |
Claude-Mem: AI Development InstructionsClaude-mem is a Claude Code plugin providing persistent memory across sessions. It captures tool usage, compresses observations using the Claude Agent SDK, and injects relevant context into future sessions. Architecture5 Lifecycle Hooks: SessionStart → UserPromptSubmit → PostToolUse → Summary → SessionEnd Hooks ( Worker Service ( Database ( Search Skill ( Planning Skill ( Execution Skill ( Chroma ( Viewer UI ( Privacy Tags
Implementation: Tag stripping happens at hook layer (edge processing) before data reaches worker/database. See Build Commandsnpm run build-and-sync # Build, sync to marketplace, restart workerConfigurationSettings are managed in File Locations
Exit Code StrategyClaude-mem hooks use specific exit codes per Claude Code's hook contract:
Philosophy: Worker/hook errors exit with code 0 to prevent Windows Terminal tab accumulation. The wrapper/plugin layer handles restart logic. ERROR-level logging is maintained for diagnostics. See Requirements
DocumentationPublic Docs: https://docs.claude-mem.ai (Mintlify) Pro Features ArchitectureClaude-mem is designed with a clean separation between open-source core functionality and optional Pro features. Open-Source Core (this repository):
Pro Features (coming soon, external):
This architecture preserves the open-source nature of the project while enabling sustainable development through optional paid features. ImportantNo need to edit the changelog ever, it's generated automatically. |
|
test |
Code ReviewGood foundational work. The Cowork compatibility, Python version fallback, and mode system are useful additions. A few items to address before merging:
|
Code ReviewGood foundational work. The Cowork compatibility, Python version fallback, and mode system are useful additions. A few items to address before merging:
|
|
test comment |
… sync Reverted ChromaMcpManager.ts python detection change (unrelated to cowork). Rebuilt worker-service.cjs from clean source without pro code contamination. Added --ignore-scripts to bun install in sync-marketplace to stop tree-sitter-cli from re-downloading its binary on every sync. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
test |
|
placeholder test |
|
test comment 2 |
|
PR Review: feat: add Cowork compatibility, /mode command, and make-mode skill Overall this is a well-scoped PR that delivers real value. A few things worth addressing before merge. Bugs / Correctness
src/services/sync/ChromaMcpManager.ts - detectPythonVersion() is invoked synchronously inside buildCommandArgs() with no caching. In the worst case (no Python 3.10-3.13 installed), this runs 4 x 5s execSync calls = up to 20 seconds of blocking before Chroma can start. On happy paths it is fast, but on misconfigured systems the worker will feel frozen. Suggestion: cache the result in a private field (cachedPythonVersion) so probing only happens once per process lifetime.
In src/services/worker/http/routes/SessionRoutes.ts, store.saveUserPrompt persists the string '[auto-initialized from observation]' to user_prompts with promptNumber = 1. Then store.getPromptNumberFromUserPrompts(contentSessionId) immediately returns 1 (from the synthetic save), so the real observation gets associated with the same prompt number as the ghost. Downstream code correlating observations to user prompts by number will see phantom entries. Suggestion: avoid writing to user_prompts for the synthetic init, or use a sentinel prompt number (e.g., 0) that downstream logic can filter.
Two observations arriving simultaneously for a new session can both pass the getSession check before either completes, resulting in duplicate init, duplicate prompts saved, and potentially two generator processes spinning up. Suggestion: a simple mutex/flag keyed by sessionDbId would prevent this. Design / Architecture
"/mode " and "/set-mode " both switch modes, but "/set-mode" additionally installs a mode CLAUDE.md and restarts the worker. cowork-modes.mdx tells users to use "/set-mode cowork", but plugin/commands/mode.md also allows "/mode cowork". A user running "/mode cowork" gets settings updated but no CLAUDE.md installed and no worker restart - they may think the mode is fully active when it is not. Suggestion: have "/mode " note that "/set-mode " is the full setup path, or document clearly in the "/mode" output that it is a lightweight switch.
The inheritance fallback lives only in the "/mode" and "/set-mode" skills. If any TypeScript code ever reads the mode JSON directly expecting these fields, it will silently get nothing. A comment in cowork--chill.json noting the inheritance intent would protect future maintainers. Minor
Positive Highlights
Generated with Claude Code |
Summary
UserPromptSubmithook doesn't fire, unblocking the entire AI processing pipeline/modecommand: List and switch modes dynamically via/modeand/mode <name>make-modeskill: Guided workflow for creating custom modes for any domainTest plan
ai.lastInteractionis no longer null viacurl localhost:37777/api/health/modelists all modes including cowork/mode coworkswitches and updates settings/mode codeswitches back without regressions/make-modewalks through mode creation and produces valid JSONcode--*language variants still load correctly🤖 Generated with Claude Code