santifer/career-ops · warning

⚠️ Unrecognized _shared.md section

Error message

⚠️  Unrecognized _shared.md section "${sectionName}" → defaulting to P${DEFAULT_PRIORITY} (compressible). Update SECTION_PRIORITY in lib/context-budget.mjs if this section is evaluation-critical.

What it means

lib/context-budget.mjs maps _shared.md section names to compression priorities (SECTION_PRIORITY). getPriority() normalizes a section name (stripping suffixes like '(Block G)') and, if the key is unknown, warns once per section and falls back to DEFAULT_PRIORITY — meaning the section is treated as compressible. If the section is actually evaluation-critical, compression may drop content the agent needed.

Solutions

  1. Add the normalized section name as a key in SECTION_PRIORITY in lib/context-budget.mjs with its correct priority
  2. Or rename the section heading in the _shared.md file to match an existing SECTION_PRIORITY key
  3. If the section genuinely is not evaluation-critical, no action is needed — the default P priority is intentionally compressible
  4. Silence per-section is once-only (_warnedSections), so fix at the source rather than ignoring repeats across runs

Example fix

// before (lib/context-budget.mjs)
const SECTION_PRIORITY = { "Core Rules": 1 };
// after
const SECTION_PRIORITY = { "Core Rules": 1, "New Guardrail": 2 };
Defensive patterns

Strategy: validation

Validate before calling

// before running context-budget tooling, verify all _shared.md headings are known
const known = Object.keys(SECTION_PRIORITY);
const headings = sharedMd.match(/^##\s+(.*)$/gm).map(h => h.replace(/^##\s+/, '').replace(/\s*\([^)]*\)/g, '').trim());
const unknown = headings.filter(h => !known.includes(h));
if (unknown.length) console.error('Add to SECTION_PRIORITY:', unknown);

Prevention

When it happens

Trigger: Calling getPriority() (directly or via context-budget compression) with a _shared.md section heading that is not a key in SECTION_PRIORITY — typically after adding or renaming a section in modes/_shared.md or a market mode file.

Common situations: Contributors adding a new section to modes/_shared.md (e.g. '## New Guardrail') without updating SECTION_PRIORITY; renaming a heading; market mode dirs introducing locally-named sections.

Related errors


AI-assisted analysis of santifer/career-ops@aac998c7ed (2026-09-16). Data as JSON: /api/errors/59ced9ad5fc33ca4. Report an issue: GitHub.

Appendix: source

Thrown at lib/context-budget.mjs:153

/**
 * Look up the priority of a section by its header name.
 *
 * Emits a warning when a section falls through to DEFAULT_PRIORITY so drift
 * between _shared.md headings and SECTION_PRIORITY is observable.
 *
 * @param {string} sectionName - The section header text (e.g., "Scoring System").
 * @returns {number} 0 (P0), 1 (P1), or 2 (P2 / default).
 */
function getPriority(sectionName) {
  const key = sectionName.toLowerCase()
    // Strip parenthetical suffixes like "(Block G)" or "(writing guardrail)"
    .replace(/\s*\([^)]*\)\s*/g, ' ')
    .replace(/\s+/g, ' ')
    .trim();
  if (!(key in SECTION_PRIORITY) && !_warnedSections.has(key)) {
    _warnedSections.add(key);
    console.warn(`⚠️  Unrecognized _shared.md section "${sectionName}" → defaulting to P${DEFAULT_PRIORITY} (compressible). Update SECTION_PRIORITY in lib/context-budget.mjs if this section is evaluation-critical.`);
  }
  return SECTION_PRIORITY[key] ?? DEFAULT_PRIORITY;
}

// ---------------------------------------------------------------------------
// Compression
// ---------------------------------------------------------------------------

/**
 * Compress _shared.md content by removing lower-priority sections.
 *
 * Sections are identified by `## Section Name` headers and removed in
 * priority order (P2 first, then P1) until the target token reduction
 * is met or no more removable sections remain.
 *
 * P0 sections (scoring, archetypes, legitimacy, global rules) are never removed.
 *
 * @param {string} sharedContent - Raw _shared.md content.

View on GitHub (pinned to aac998c7ed)