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/lib/topics.mjs

View on GitHub
// Topics: a tag that has a page. Their one-line summaries, the digest's topic lines, the topics a message names,
// and the pages one step from a topic's page. The profile lists the topics; nothing here reads the store.
import { readFileSync } from 'node:fs';
import { join, posix } from 'node:path';

const SUMMARY_CHARS = 120;
const COMPANY_LINES = 8;
const MAX_BYTES = 1024;
const MAX_MATCHES = 3;
const NEAR_LETTERS = 4;

const FRONT = /^---\r?\n[\s\S]*?\r?\n---[ \t]*(?:\r?\n|$)/;
const LINK = /\]\(<?([^)\s>]+)>?(?:\s+"[^"]*")?\)/g;

const cut = (text, max) => {
  if (text.length <= max) return text;
  const space = text.lastIndexOf(' ', max);
  return `${text.slice(0, space > 0 ? space : max).replace(/[\s,;:]+$/, '')}…`;
};

/** A page's first sentence after its frontmatter and title, links read as their words, cut on a word. */
export function summaryOf(text) {
  const body = String(text).replace(FRONT, '').replace(/^\s*# .*$/m, '');
  const para = body.split(/\n\s*\n/).map(block => block.trim()).find(block => block && !/^(#|```|~~~|<!--)/.test(block)) ?? '';
  const plain = para.replace(/!?\[([^\]]*)\]\([^)]*\)/g, '$1').replace(/\*\*|__/g, '').replace(/\s+/g, ' ');
  return cut(/^.+?[.!?](?=\s|$)/.exec(plain)?.[0] ?? plain, SUMMARY_CHARS - 1);
}

const fits = lines => Buffer.byteLength(lines.join('\n')) <= MAX_BYTES;

// The digest's topic block: the company topics the hub links, in its order, then the code topics' names, then how
// to pull one. Company lines go while room is left; the code line drops names from its end to fit.
export function topicLines(topics, script) {
  if (!topics.length) return [];
  const company = topics.filter(topic => topic.kind === 'company' && topic.hub != null).sort((a, b) => a.hub - b.hub);
  const names = topics.filter(topic => topic.kind === 'code').map(topic => topic.tag);
  const pull = `Pull a topic: \`${script} pull <topic>\``;
  const lines = ['## Topics'];
  for (const topic of company.slice(0, COMPANY_LINES)) {
    const line = `${topic.tag}  ${topic.summary}`;
    if (!fits([...lines, line, names.length ? `Code: ${names.slice(0, 3).join(', ')}, …` : '', pull])) break;
    lines.push(line);
  }
  if (names.length) {
    let shown = names.length;
    const codeLine = () => `Code: ${names.slice(0, shown).join(', ')}${shown < names.length ? ', …' : ''}`;
    while (shown > 1 && !fits([...lines, codeLine(), pull])) shown--;
    lines.push(codeLine());
  }
  return [...lines, pull];
}

// Lowercase words, with `/` and `-` read as spaces, so `people/ada` and `people-ada` both read `people ada`.
const words = text => String(text).toLowerCase().split(/[^\p{L}\p{N}]+/u).filter(Boolean);
const has = (said, phrase) => phrase.length > 0 && said.includes(` ${phrase.join(' ')} `);

// The topics a message names, clear matches first, three at most: `[{ topic, clear }]`. Clear: the whole tag, an
// alias, or a company tag's last part, as whole words. Near: a word of 4+ letters that starts a word of the tag.
export function matchTopics(message, topics, { skip = [], skills = [] } = {}) {
  const left = new Set([...skip, ...skills]);
  const msg = words(message);
  const said = ` ${msg.join(' ')} `;
  const stems = msg.filter(word => word.length >= NEAR_LETTERS);
  const clear = [];
  const near = [];
  for (const topic of topics) {
    if (left.has(topic.tag)) continue;
    const names = [topic.tag, ...(topic.aliases || []), ...(topic.kind === 'company' ? [topic.tag.split('/').at(-1)] : [])];
    if (names.some(name => has(said, words(name)))) clear.push({ topic, clear: true });
    else if (words(topic.tag).some(part => stems.some(stem => part.startsWith(stem)))) near.push({ topic, clear: false });
  }
  return [...clear, ...near].slice(0, MAX_MATCHES);
}

// The pages a page links to, as repo paths; a folder link lands on its README.md.
function linksOf(root, page) {
  let text;
  try { text = readFileSync(join(root, page), 'utf8'); } catch { return []; }
  return [...text.matchAll(LINK)].map(([, written]) => written.replace(/[#?].*$/, ''))
    .filter(target => target && !/^[a-z][a-z0-9+.-]*:/i.test(target))
    .map(target => posix.normalize(target.startsWith('/') ? target.slice(1) : posix.join(posix.dirname(page), target)))
    .map(target => (target.endsWith('.md') ? target : posix.join(target, 'README.md')));
}

/** The pages among `pages` one step from `page`: those it links to (`out`) and those that link to it (`in`). */
export function pageLinks(root, page, pages) {
  const known = new Set(pages);
  return {
    out: [...new Set(linksOf(root, page))].filter(path => path !== page && known.has(path)),
    in: pages.filter(path => path !== page && linksOf(root, path).includes(page)),
  };
}
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