repositories / pi-ext
pi-ext
bugabingas pi extensions
owned by bugabinga
extensions/prune/src/constants.ts
RawFile outline
- DEFAULT_SECTION_LIMIT line 7
- DEFAULT_TRANSCRIPT_LIMIT line 8
- DEFAULT_TOOL_CAP line 9
- MAX_RAW_TAIL_TOKENS line 10
- TRUNCATE_USER line 12
- TRUNCATE_ASSISTANT line 13
- BLOCKER_RE line 17
- SELF_TALK_PREFIX_RE line 22
- GOAL_VERBS line 27
- GOAL_RE line 64
- SCOPE_CHANGE_RE line 69
- NOISE_SHORT_RE line 72
- NON_GOAL_RE line 75
- TEMPLATE_SIGNAL_RE line 78
- INTERROGATIVE_RE line 81
- PREF_PATTERNS line 86
- GENERATED_PREF_FALSE_POSITIVE_RE line 95
- FILE_PATH_RE line 100
- SECTION_SESSION line 104
- SECTION_FILES line 105
- SECTION_CONTEXT line 106
- SECTION_PREFS line 107
- SECTION_CONTINUE line 108
- SECTION_COMMITS line 109
- SEPARATOR line 110
- RECALL_NOTE line 112
/**
* prune — constants
*/
// ─── Limits ─────────────────────────────────────────────────────────────────
export const DEFAULT_SECTION_LIMIT = 8;
export const DEFAULT_TRANSCRIPT_LIMIT = 60;
export const DEFAULT_TOOL_CAP = 8;
export const MAX_RAW_TAIL_TOKENS = 32000;
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_CONTINUE = "[Continue Now]";
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.";