{"record":{"id":"e7f854ccc65aa4c6","repo":"Yeachan-Heo/oh-my-codex","slug":"refusing-to-derive-parentitems-length-implicit","errorCode":null,"errorMessage":"Refusing to derive ${parentItems.length} implicit ultragoal goals from ${sourceKind}. Pass compact executable stories with repeated --goal \"Title::Objective\" entries, or rewrite the brief with an explicit ### Stories/### Goals section containing no more than ${MAX_IMPLICIT_MARKDOWN_GOALS} parent stories.","messagePattern":"Refusing to derive (.+?) implicit ultragoal goals from (.+?)\\. Pass compact executable stories with repeated --goal \"Title::Objective\" entries, or rewrite the brief with an explicit ### Stories/### Goals section containing no more than (.+?) parent stories\\.","errorType":"validation","errorClass":"UltragoalError","httpStatus":null,"severity":"error","filePath":"src/ultragoal/artifacts.ts","lineNumber":461,"sourceCode":"}\n\nfunction hasExplicitStorySection(items: readonly MarkdownListItem[]): boolean {\n  return items.some((item) => sectionLooksStory(item.section));\n}\n\nfunction briefLooksPlanLikeHandoff(lines: readonly string[]): boolean {\n  return lines.some((line) => {\n    const label = normalizeSectionLabel(line);\n    if (sectionLooksPlanReview(label)) return true;\n    return /\\b(?:RALPLAN|G\\d{3,}\\s+(?:verdict|review|status)|review\\s+artifact|consensus\\s+status|planner\\s+consensus|critic\\s+review|architect\\s+review)\\b/i.test(line);\n  });\n}\n\nfunction assertSafeImplicitMarkdownGoalCount(brief: string, parsedItems: readonly MarkdownListItem[], parentItems: readonly MarkdownListItem[]): void {\n  if (hasExplicitStorySection(parsedItems)) return;\n  if (parentItems.length <= MAX_IMPLICIT_MARKDOWN_GOALS) return;\n  const sourceKind = briefLooksPlanLikeHandoff(brief.split(/\\r?\\n/)) ? 'plan/review handoff markdown' : 'broad markdown';\n  throw new UltragoalError(`Refusing to derive ${parentItems.length} implicit ultragoal goals from ${sourceKind}. Pass compact executable stories with repeated --goal \"Title::Objective\" entries, or rewrite the brief with an explicit ### Stories/### Goals section containing no more than ${MAX_IMPLICIT_MARKDOWN_GOALS} parent stories.`);\n}\n\nfunction normalizeObjective(value: string): string {\n  return value.replace(/\\s+/g, ' ').trim();\n}\n\nconst OBJECTIVE_MAPPING_STOP_WORDS = new Set([\n  'about',\n  'active',\n  'aggregate',\n  'audit',\n  'brief',\n  'build',\n  'clean',\n  'codex',\n  'complete',\n  'completed',\n  'different',","sourceCodeStart":443,"sourceCodeEnd":479,"githubUrl":"https://github.com/Yeachan-Heo/oh-my-codex/blob/3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2/src/ultragoal/artifacts.ts#L443-L479","documentation":"assertSafeImplicitMarkdownGoalCount is a guard inside deriveGoalCandidates: when a markdown brief has no explicit `### Stories`/`### Goals` section but its top-level bullet list contains more than MAX_IMPLICIT_MARKDOWN_GOALS parent items, the library refuses to auto-derive goals. This prevents feeding a whole plan/review handoff document (which happens to be markdown with many bullets) into the ultragoal pipeline as if each bullet were a story.","triggerScenarios":"Calling deriveGoalCandidates (or the ultragoal CLI deriving goals) with a markdown brief that (a) lacks an explicit Stories/Goals heading and (b) has more than MAX_IMPLICIT_MARKDOWN_GOALS top-level list items. briefLooksPlanLikeHandoff further classifies it, but the refusal happens regardless of that classification once the count is exceeded.","commonSituations":"Pasting a full implementation plan, PR review, or meeting-notes document as the brief instead of compact stories; using one big markdown file for everything; migrating from a tool that accepted arbitrary markdown briefs; hallucinating that the AI will 'figure out' the story decomposition from a wall of bullets.","solutions":["Add an explicit `### Stories` (or `### Goals`) section to the brief containing at most MAX_IMPLICIT_MARKDOWN_GOALS parent stories","Replace the implicit bullets with repeated explicit --goal \"Title::Objective\" CLI entries","Trim the brief down to only executable parent stories and move plan/handoff context into a separate reference doc","If the document is really a plan/review handoff, split it: extract the actionable stories first, then pass those"],"exampleFix":"// before\n// brief.md: 40 top-level bullets of plan/review notes, no Stories heading\nderiveGoalCandidates(briefMarkdown); // refuses\n\n// after\n// brief.md:\n// ### Stories\n// - Fix login redirect::Redirect after OAuth callback\n// - Add rate limit::Cap API at 100 req/min\nderiveGoalCandidates(briefMarkdown); // ok","handlingStrategy":"validation","validationCode":"const STORY_HEADING = /^#{2,3}\\s*(Stories|Goals)\\b/m;\n\nfunction briefIsSafeForImplicitDerivation(brief: string, maxParentItems = MAX_IMPLICIT_MARKDOWN_GOALS): boolean {\n  if (STORY_HEADING.test(brief)) return true; // explicit section bypasses the guard\n  const parentItems = brief.split(/\\r?\\n/).filter((l) => /^[-*+]\\s+/.test(l) && !/^\\s/.test(l));\n  return parentItems.length <= maxParentItems;\n}","typeGuard":"function isImplicitGoalCountError(e: unknown): boolean {\n  return e instanceof UltragoalError && /implicit ultragoal goals/.test(e.message);\n}","tryCatchPattern":"try {\n  deriveGoalCandidates(brief);\n} catch (e) {\n  if (isImplicitGoalCountError(e)) {\n    // restructure brief: add ### Stories section or switch to explicit --goal entries\n  } else throw e;\n}","preventionTips":["Always include an explicit ### Stories or ### Goals section in ultragoal briefs","Prefer repeated --goal \"Title::Objective\" flags over large markdown briefs","Keep parent stories under MAX_IMPLICIT_MARKDOWN_GOALS; nest details as child bullets"],"tags":["ultragoal","markdown","validation","input-validation"],"backgroundTag":"input-validation-failed","analyzedSha":"3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2","analyzedAt":"2026-08-27T22:18:39.783Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}