Skip to content

matthewwong525/WongStack / .agents/plugins/memory

memory

Verified

FileKindSize
README.mdmarkdown4.7 KB
SKILL.mdskill md5.8 KB
VERSIONother6 B
hooks/claude.jsonconfig957 B
hooks/codex.jsonconfig692 B
references/placing-facts.mdmarkdown2.1 KB
references/recall-helper.mdmarkdown814 B
references/setup.mdmarkdown7.0 KB
references/tidy.mdmarkdown4.4 KB
references/writing-facts.mdmarkdown2.0 KB
scripts/before-edit.mjsscript2.5 KB
scripts/daily-tidy.mjsscript22.1 KB
scripts/lib/areas.mjsscript3.9 KB
scripts/lib/brief.mjsscript2.3 KB
scripts/lib/cli.mjsscript1.2 KB
scripts/lib/daily.mjsscript1.6 KB
scripts/lib/digest.mjsscript11.9 KB
scripts/lib/documents/commands.mjsscript5.7 KB
scripts/lib/documents/corpus.mjsscript6.8 KB
scripts/lib/documents/input.mjsscript2.4 KB
scripts/lib/documents/lexical.mjsscript4.5 KB
scripts/lib/documents/packet.mjsscript10.2 KB
scripts/lib/documents/retrieve.mjsscript1.9 KB
scripts/lib/files.mjsscript3.7 KB
scripts/lib/headless.mjsscript1.5 KB
scripts/lib/knowledge-copy.mjsscript469 B
scripts/lib/machine-id.mjsscript1.9 KB
scripts/lib/primary-root.mjsexecutablescript1.9 KB
scripts/lib/pull.mjsscript27.0 KB
scripts/lib/read-facts.mjsscript1.7 KB
scripts/lib/read-options.mjsscript3.0 KB
scripts/lib/scan.mjsscript2.0 KB
scripts/lib/store.mjsscript7.7 KB
scripts/lib/topics.mjsscript4.6 KB
scripts/lib/transcripts.mjsscript9.6 KB
scripts/lib/upkeep.mjsscript4.0 KB
scripts/lib/usage.mjsscript5.2 KB
scripts/memory.mjsscript45.7 KB
scripts/run.mjsscript20.4 KB
scripts/session-end.mjsscript1.7 KB
scripts/session-start.mjsscript4.6 KB
scripts/topic-match.mjsscript2.1 KB
store/contract.mjsscript14.6 KB
store/interface.d.mtsother2.9 KB
store/interface.mjsscript6.7 KB

scripts/before-edit.mjs

View on GitHub
#!/usr/bin/env node
// PreToolUse hook on file edits: the first time a session edits a file in a mapped folder, show that area's open
// threads and newest live facts. It never blocks an edit: any failure prints nothing, and it always exits 0.
import { readFileSync } from 'node:fs';
import { parseCli } from './lib/cli.mjs';
import { areasOf, loadAreas } from './lib/areas.mjs';
import { formatFact } from './lib/digest.mjs';
import { isMain, openStore, readJson, repoContext, statePath, writeJson } from './lib/store.mjs';

const BUDGET_MS = 2500;
const LINES = 8;

// The edited files: Claude Code's Edit, Write, and MultiEdit name file_path, and NotebookEdit notebook_path;
// Codex's apply_patch names each file in its patch's headers.
export function editedPaths({ tool_input: tool = {} }) {
  const own = [tool.file_path, tool.notebook_path].filter(Boolean);
  const patch = typeof tool.command === 'string' ? tool.command : '';
  return [...own, ...[...patch.matchAll(/^\*\*\* (?:(?:Add|Update|Delete) File|Move to): (.+)$/gm)].map(([, path]) => path.trim())];
}

// The hook's output for one edit, or '' when it shows nothing.
export async function beforeEdit(input) {
  const paths = editedPaths(input);
  if (!paths.length) return '';
  const ctx = repoContext(input.cwd || process.cwd());
  const shownFile = statePath(ctx, 'shown-areas', `${String(input.session_id || 'unknown').replace(/[^\w.-]/g, '_')}.json`);
  const shown = readJson(shownFile, []);
  const areas = await loadAreas(ctx);
  const tags = [...new Set(paths.flatMap(path => areasOf(path, areas, ctx.root)))].filter(tag => !shown.includes(tag));
  if (!tags.length) return '';
  const store = await openStore(ctx, { timeoutMs: BUDGET_MS });
  const [facts] = await store.facts([{ tags, order: 'threads-first', limit: LINES }]);
  writeJson(shownFile, [...shown, ...tags]);
  if (!facts.length) return '';
  const additionalContext = [`Memory for ${tags.join(', ')}:`, ...facts.map(fact => formatFact(fact))].join('\n');
  return `${JSON.stringify({ hookSpecificOutput: { hookEventName: 'PreToolUse', additionalContext } })}\n`;
}

if (isMain(import.meta.url)) {
  parseCli({ usage: 'usage: before-edit.mjs   the PreToolUse hook on file edits; reads the hook\'s JSON on stdin' });
  let out = '';
  try { out = await beforeEdit(JSON.parse(readFileSync(0, 'utf8') || '{}')); } catch { /* never blocks an edit */ }
  // Exit once the output is flushed: an aborted fetch's socket would otherwise hold the hook past its timeout.
  process.stdout.write(out, () => process.exit(0));
}
slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack."Stars: 198kUpdated Claude CodeCodexVerifiedInstall
ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt.Stars: 194kUpdated Claude CodeCodexVerifiedInstall