mirror of
https://github.com/affaan-m/everything-claude-code.git
synced 2026-03-30 13:43:26 +08:00
Adds the ck (Context Keeper) skill — deterministic Node.js scripts that give Claude Code persistent, per-project memory across sessions. Architecture: - commands/ — 8 Node.js scripts handle all command logic (init, save, resume, info, list, forget, migrate, shared). Claude calls scripts and displays output — no LLM interpretation of command logic. - hooks/session-start.mjs — injects ~100 token compact summary on session start (not kilobytes). Detects unsaved sessions, git activity since last save, goal mismatch vs CLAUDE.md. - context.json as source of truth — CONTEXT.md is generated from it. Full session history, session IDs, git activity per save. Commands: /ck:init /ck:save /ck:resume /ck:info /ck:list /ck:forget /ck:migrate Source: https://github.com/sreedhargs89/context-keeper Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
45 lines
1.3 KiB
JavaScript
45 lines
1.3 KiB
JavaScript
#!/usr/bin/env node
|
|
/**
|
|
* ck — Context Keeper v2
|
|
* forget.mjs — remove a project's context and registry entry
|
|
*
|
|
* Usage: node forget.mjs [name|number]
|
|
* stdout: confirmation or error
|
|
* exit 0: success exit 1: not found
|
|
*
|
|
* Note: SKILL.md instructs Claude to ask "Are you sure?" before calling this script.
|
|
* This script is the "do it" step — no confirmation prompt here.
|
|
*/
|
|
|
|
import { rmSync } from 'fs';
|
|
import { resolve } from 'path';
|
|
import { resolveContext, readProjects, writeProjects, CONTEXTS_DIR } from './shared.mjs';
|
|
|
|
const arg = process.argv[2];
|
|
const cwd = process.env.PWD || process.cwd();
|
|
|
|
const resolved = resolveContext(arg, cwd);
|
|
if (!resolved) {
|
|
const hint = arg ? `No project matching "${arg}".` : 'This directory is not registered.';
|
|
console.log(`${hint}`);
|
|
process.exit(1);
|
|
}
|
|
|
|
const { name, contextDir, projectPath } = resolved;
|
|
|
|
// Remove context directory
|
|
const contextDirPath = resolve(CONTEXTS_DIR, contextDir);
|
|
try {
|
|
rmSync(contextDirPath, { recursive: true, force: true });
|
|
} catch (e) {
|
|
console.log(`ck: could not remove context directory — ${e.message}`);
|
|
process.exit(1);
|
|
}
|
|
|
|
// Remove from projects.json
|
|
const projects = readProjects();
|
|
delete projects[projectPath];
|
|
writeProjects(projects);
|
|
|
|
console.log(`✓ Context for '${name}' removed.`);
|