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/areas.mjs

View on GitHub
// Areas: the profile's topics as tag -> { definition, paths, docs, aliases, kind, page }; which tags a repo path
// falls in; and the docs an area names.
import { existsSync, realpathSync } from 'node:fs';
import { isAbsolute, join, relative } from 'node:path';
import { loadProfile } from './store.mjs';

export const areaMap = topics => Object.fromEntries(topics.map(({ tag, summary, paths = [], docs = [], aliases = [], kind, page }) =>
  [tag, { definition: summary, paths, docs, aliases, kind, page }]));

// A missing profile or a broken topic list maps nothing, so no write ever fails on it.
export async function loadAreas(ctx, profile) {
  try { return areaMap(await (profile ?? await loadProfile(ctx))?.topics?.(ctx) ?? []); } catch { return {}; }
}

// The topic a tag names, through the areas' alias lists and the store's own aliases; null for a tag with no page.
export function topicNamer(areas, tagRows = []) {
  const alias = new Map([...tagRows.filter(row => row.alias_of).map(row => [row.name, row.alias_of]),
    ...Object.entries(areas).flatMap(([tag, area]) => (area.aliases || []).map(name => [name, tag]))]);
  return tag => [tag, alias.get(tag)].find(name => name && areas[name]?.page) ?? null;
}

// A repo-relative path, with .claude/ and .codex/ read as .agents/; null for a path outside the repo.
export function normalizePath(path, root) {
  let rel = path.replace(/^\.\//, '');
  if (isAbsolute(rel)) {
    if (!root) return null;
    rel = relative(root, rel);
    if (rel.startsWith('..') || isAbsolute(rel)) return null;
  }
  return rel.replace(/^\.(?:claude|codex)\//, '.agents/');
}

// The repo path a path really is, through any symlinked folder, so one file has one name; null when it is missing.
export function realPath(path, root) {
  try {
    const rel = relative(realpathSync(root), realpathSync(join(root, path)));
    return rel && !rel.startsWith('..') && !isAbsolute(rel) ? rel : null;
  } catch { return null; }
}

// The tags of a path's longest matching prefix, and that prefix's length; equal-length matches all count.
export function longestArea(path, areas, root) {
  const rel = normalizePath(path, root);
  let longest = 0;
  let tags = [];
  for (const [tag, { paths = [] }] of Object.entries(areas)) {
    for (const prefix of paths) {
      if (!rel?.startsWith(prefix) || prefix.length < longest) continue;
      if (prefix.length > longest) { longest = prefix.length; tags = []; }
      tags.push(tag);
    }
  }
  return { tags: [...new Set(tags)], longest };
}

// A path's areas: its longest matching folder prefix, plus each area that names it among its docs, so a spec
// or wiki page lands on its own subject, not only the folder that holds it.
export function areasOf(path, areas, root) {
  const rel = normalizePath(path, root);
  const named = rel ? Object.keys(areas).filter(tag => (areas[tag].docs || []).includes(rel)) : [];
  return [...new Set([...longestArea(path, areas, root).tags, ...named])];
}

// The docs the tags' areas name, in list order, once each; a doc this repo lacks is skipped.
export function areaDocs(tags, areas, root) {
  return [...new Set(tags.flatMap(tag => areas[tag]?.docs || []))].filter(doc => existsSync(join(root, doc)));
}

// Each area the paths fall in, with the first path that put it there.
export function pathAreas(paths, areas, root) {
  const found = new Map();
  for (const path of paths) for (const tag of areasOf(path, areas, root)) if (!found.has(tag)) found.set(tag, path);
  return found;
}

// newTags plus every topic tag the facts use that the store lacks, defined from its summary.
export function withAreaTags(existing, facts, newTags, areas) {
  const named = new Set([...existing, ...(newTags || []).map(tag => tag.name)]);
  const missing = [...new Set(facts.flatMap(fact => fact.tags || []))].filter(tag => !named.has(tag) && areas[tag]?.definition);
  return [...(newTags || []), ...missing.map(name => ({ name, definition: areas[name].definition }))];
}
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