Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Extend the `thinkingVerbs` patch to cover past-tense verbs e.g. "Baked" (#454) - @bl-ue
- Only apply the `thinkingBlockStyling` patch in CC version under 2.1.26 (#455) - @bl-ue
- Fix `subagentModels` patch to not error when nothing was changed (#456) - @bl-ue
- Enable the builtin `/remember` skill (#457) - @bl-ue
- AGENTS.md support for Claude Code (#459) - @bl-ue

## [v3.4.0](https://github.com/Piebald-AI/tweakcc/releases/tag/v3.4.0) - 2026-01-18
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ $ pnpm dlx tweakcc
- Suppression of `1→ ` prefixes from `Read` output
- Suppress `/rate-limit-options` from being injected
- Swarm mode
- Session memory
- `/remember` skill
- [Toolsets](#toolsets)
- User message display customization
- Token indicator display
Expand Down
3 changes: 2 additions & 1 deletion src/defaultSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -697,7 +697,7 @@ export const DEFAULT_SETTINGS: Settings = {
hideCtrlGToEdit: false,
hideStartupClawd: false,
increaseFileReadLimit: false,
suppressLineNumbers: true,
suppressLineNumbers: false,
suppressRateLimitOptions: false,
mcpConnectionNonBlocking: true,
mcpServerBatchSize: null,
Expand All @@ -706,6 +706,7 @@ export const DEFAULT_SETTINGS: Settings = {
tableFormat: 'default',
enableSwarmMode: true,
enableSessionMemory: true,
enableRememberSkill: false,
tokenCountRounding: null,
},
toolsets: [],
Expand Down
12 changes: 12 additions & 0 deletions src/patches/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ import { writeSuppressLineNumbers } from './suppressLineNumbers';
import { writeSuppressRateLimitOptions } from './suppressRateLimitOptions';
import { writeSwarmMode } from './swarmMode';
import { writeSessionMemory } from './sessionMemory';
import { writeRememberSkill } from './rememberSkill';
import { writeThinkingBlockStyling } from './thinkingBlockStyling';
import { writeMcpNonBlocking, writeMcpBatchSize } from './mcpStartup';
import { writeStatuslineUpdateThrottle } from './statuslineUpdateThrottle';
Expand Down Expand Up @@ -310,6 +311,13 @@ const PATCH_DEFINITIONS = [
description:
'Round displayed token counts to the nearest multiple of chosen value',
},
{
id: 'remember-skill',
name: 'Remember skill',
group: PatchGroup.MISC_CONFIGURABLE,
description:
'Register the built-in "/remember" skill to review session memories and update CLAUDE.local.md',
},
{
id: 'agents-md',
name: 'AGENTS.md (and others)',
Expand Down Expand Up @@ -713,6 +721,10 @@ export const applyCustomization = async (
writeTokenCountRounding(c, config.settings.misc!.tokenCountRounding!),
condition: !!config.settings.misc?.tokenCountRounding,
},
'remember-skill': {
fn: c => writeRememberSkill(c),
condition: !!config.settings.misc?.enableRememberSkill,
},
'agents-md': {
fn: c => writeAgentsMd(c, config.settings.claudeMdAltNames!),
condition: !!(
Expand Down
83 changes: 83 additions & 0 deletions src/patches/rememberSkill.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
// Please see the note about writing patches in ./index

import { showDiff } from './index';

/**
* Registers the builtin "/remember" skill that allows users to review session memories
* and update CLAUDE.local.md with learnings from past sessions.
*
* Pattern 1 - Find skill registration function:
* ```
* {SKILL_REG_FN({name:"claude-in-chrome"...
* ```
*
* Pattern 2 - Find injection point:
* ```diff
* function SESSION_MEM_LOADER(...){...}function XX(){
* + SKILL_REG_FN({name:"remember",...});
* return
* }var SKILL_DATA_VAR=`# Remember Skill...
* ```
*/

const findSkillRegistrationFn = (file: string): string | null => {
const pattern = /\{([$\w]+)\(\{name:"claude-in-chrome"/;
const match = file.match(pattern);
if (!match) {
console.error(
'patch: rememberSkill: failed to find skill registration function'
);
return null;
}
return match[1];
};

export const writeRememberSkill = (oldFile: string): string | null => {
// Find the skill registration function name
const skillRegistrationFn = findSkillRegistrationFn(oldFile);
if (!skillRegistrationFn) {
return null;
}

// Find the injection point pattern
const pattern =
/(function ([$\w]+)\(.{0,500}\}function [$\w]+\(\)\{)return(\}var ([$\w]+)=`# Remember Skill)/;
const match = oldFile.match(pattern);

if (!match || match.index === undefined) {
console.error(
'patch: rememberSkill: failed to find injection point pattern'
);
return null;
}

const [fullMatch, pre, sessionMemLoaderFn, post, skillDataVar] = match;

// Build the insertion code
const insertCode = `
${skillRegistrationFn}({
name: "remember",
description: "Review session memories and update CLAUDE.local.md with learnings",
whenToUse: "When the user wants to save learnings from past sessions",
userInvocable: true,
isEnabled: () => true,
async getPromptForCommand(A) {
let content = ${skillDataVar};
let sessionMemFiles = ${sessionMemLoaderFn}(null);
content += "\\n\\n## Session Memory Files to Review\\n\\n" + (sessionMemFiles.length ? sessionMemFiles.join("\\n") : "None found");
if (A) content += "\\n\\n## User Arguments\\n\\n" + A;
return [{ type: "text", text: content }];
},
});
`;

const replacement = pre + insertCode + 'return' + post;
const startIndex = match.index;
const endIndex = startIndex + fullMatch.length;

const newFile =
oldFile.slice(0, startIndex) + replacement + oldFile.slice(endIndex);

showDiff(oldFile, newFile, replacement, startIndex, endIndex);
return newFile;
};
1 change: 1 addition & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ export interface MiscConfig {
tableFormat: TableFormat;
enableSwarmMode: boolean;
enableSessionMemory: boolean;
enableRememberSkill: boolean;
tokenCountRounding: number | null;
}

Expand Down
15 changes: 15 additions & 0 deletions src/ui/components/MiscView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ export function MiscView({ onSubmit }: MiscViewProps) {
tableFormat: 'default' as TableFormat,
enableSwarmMode: true,
enableSessionMemory: true,
enableRememberSkill: false,
tokenCountRounding: null as number | null,
};

Expand Down Expand Up @@ -451,6 +452,20 @@ export function MiscView({ onSubmit }: MiscViewProps) {
});
},
},
{
id: 'enableRememberSkill',
title: 'Enable remember skill',
description:
'Register a "remember" skill to review session memories and update CLAUDE.local.md with learnings from past sessions.',
getValue: () => settings.misc?.enableRememberSkill ?? false,
toggle: () => {
updateSettings(settings => {
ensureMisc();
settings.misc!.enableRememberSkill =
!settings.misc!.enableRememberSkill;
});
},
},
{
id: 'tokenCountRounding',
title: 'Token count rounding',
Expand Down