repositories / dotfiles

dotfiles

bugabingas dorkfiles

owned by bugabinga

pi/agent/extensions/prune/src/constants.ts

Raw
File outline
/**
 * prune — constants
 */

// ─── Limits ─────────────────────────────────────────────────────────────────

export const DEFAULT_SECTION_LIMIT = 8;
export const DEFAULT_TRANSCRIPT_LIMIT = 120;
export const DEFAULT_TOOL_CAP = 8;

export const TRUNCATE_USER = 256;
export const TRUNCATE_ASSISTANT = 200;

// ─── Blockers ─────────────────────────────────────────────────────────────

export const BLOCKER_RE = /\b(fail(ed|s|ure|ing)?|broken|cannot|can't|won't work|does not work|doesn't work|still (broken|failing|wrong)|blocked|blocker|not (fixed|resolved|working)|crash(es|ed|ing)?)\b/i;

// ─── Self-talk prefixes ──────────────────────────────────────────────────

export const SELF_TALK_PREFIX_RE = /^\s*(?:hmm|wait|actually|oh|okay|ok|well|so)[,.!\s-]+/i;

// ─── Goal patterns ────────────────────────────────────────────────────────

export const GOAL_VERBS = [
  'scan', 'check', 'fix', 'implement', 'add', 'create', 'build', 'refactor',
  'debug', 'investigate', 'update', 'remove', 'delete', 'migrate', 'deploy',
  'test', 'write', 'set up', 'spin', 'run', 'execute', 'verify', 'review',
  'analyze', 'explain', 'describe', 'explore', 'call', 'use', 'switch',
  'clean', 'lint', 'format', 'do',
];

export const GOAL_RE = new RegExp(
  `\\b(${GOAL_VERBS.map(v => v.replace(/ /g, '\\s+')).join('|')})\\b`,
  'i',
);

export const SCOPE_CHANGE_RE = /\b(also|instead|actually|change of plan|forget that|new task|switch to|now i want|pivot|let'?s do|stop .* and|while we'?re at it|for now)\b/i;

export const NOISE_SHORT_RE = /^(ok|okay|yes|no|yep|nope|go|hi|hey|thanks?|thx|k|y|n|done|go ahead|looks good|sounds good|lgtm|sounds right|makes sense|sure|please|thank|noop)\s*[.!?]*$/i;

export const NON_GOAL_RE = /^\s*[\[│├└─╭╰─]|```|^\s*(=[A-Z_]+\(|function |const |let |var |import |export |class |async |await |interface |type )|^(https?:\/\/|file:|\/[a-z])|^\s*```|\s*```\s*$|^\s*\| |^\s*For each\b|\bin full\b[^\n]*\b(comments?|issues?|PRs?|linked)\b|^@[\w\/.-]+\s*$/i;

export const TEMPLATE_SIGNAL_RE = /^\s*(<skill\b|```|For each\b|Do NOT\b|Analyze and propose\b|If [Tt]ask|Output:\s*$|here'?s a|ticket:)\b/i;

export const INTERROGATIVE_RE = /^\s*(what|why|how|when|where|who|which|is|are|was|were|do|does|did|should|could|would)\b/i;

// ─── Preference patterns ─────────────────────────────────────────────────

export const PREF_PATTERNS = [
  /\bprefer(?:s|red|ring)?\s+\w/i,
  /\bdon'?t want\b/i,
  /\balways (?:use|do|run|prefer|keep|make|format|write|add|set|put|prefix|start|include|append|check)\b/i,
  /\bnever (?:use|do|run|push|commit|write|ignore|add|set|put|remove|delete|include|deploy)\b/i,
  /\bplease (?:use|avoid|keep|make|don'?t|do not|format|write)\b/i,
  /\b(?:style|format|language|naming)\s*[:=]\s*\S/i,
];

export const GENERATED_PREF_FALSE_POSITIVE_RE = /\bPOV\b.*\bformat\s*[:=]\s*engagement\b/i;

// ─── File path patterns ─────────────────────────────────────────────────

export const FILE_PATH_RE = /(?:^|\/)([^\/\s]+\.[a-zA-Z0-9]+$)/;

// ─── Section headers ─────────────────────────────────────────────────────

export const SECTION_SESSION = '[Session Goal]';
export const SECTION_FILES = '[Files And Changes]';
export const SECTION_CONTEXT = '[Outstanding Context]';
export const SECTION_PREFS = '[User Preferences]';
export const SECTION_COMMITS = '[Commits]';
export const SEPARATOR = '\n\n---\n\n';

export const RECALL_NOTE = 'Use prune_recall to search for prior work, decisions, and context from before this summary.\nDo not redo work already completed.';