Skip to content

[Bug]: SM *draft intermittently fails to find story-tmpl.yaml: source agent resolves templates to .aiox-core/development/templates (wrong) while the file lives in .aiox-core/product/templates #812

Description

@renatolhamas

Bug Description

Running *draft with the SM agent often fails to locate the story template
(story-tmpl.yaml). When it fails, the agent improvises — it searches, and
if it can't find the template, it falls back to copying the previous
story's shape. The result is inconsistent story structure.

Root cause is a contradiction between the two SM agent files shipped by
the installer, plus an outdated dependency-resolution rule:

  1. The template physically lives at:
    .aiox-core/product/templates/story-tmpl.yaml
    The folder .aiox-core/development/templates/ EXISTS but does NOT contain
    story-tmpl.yaml (it holds agent-handoff-tmpl.yaml, research-prompt-tmpl.md,
    etc.).

  2. Source agent .aiox-core/development/agents/sm.md uses a generic rule:
    line 12: "Dependencies map to .aiox-core/development/{type}/{name}"
    line 175: declares the dependency as a bare name: "story-tmpl.yaml"
    Applying it literally resolves to
    .aiox-core/development/templates/story-tmpl.yaml -> DOES NOT EXIST
    so resolution fails and the LLM starts guessing.

  3. Native subagent .claude/agents/aiox-sm.md has the CORRECT path:
    line 60: "templates at .aiox-core/product/templates/"

Because both agent files coexist, behavior depends on which one drives the
session: the native subagent finds it, the source/shim-driven path does
not. Hence the "sometimes works, sometimes doesn't" intermittency.

Underlying design flaw: templates are split across two physical folders
(.aiox-core/development/templates/ and .aiox-core/product/templates/), so a
"type -> single folder" mapping cannot resolve bare template names
deterministically.

Steps to Reproduce

  1. Fresh install (npx aiox-core@latest install), greenfield, Claude Code + Codex.
  2. Confirm layout:
    • .aiox-core/product/templates/story-tmpl.yaml exists
    • .aiox-core/development/templates/story-tmpl.yaml MISSING
  3. Open .aiox-core/development/agents/sm.md and note:
    • line ~12: "Dependencies map to .aiox-core/development/{type}/{name}"
    • dependencies.templates lists bare "story-tmpl.yaml"
  4. Activate SM and run: *draft
  5. Observe the agent resolve the template to
    .aiox-core/development/templates/story-tmpl.yaml, fail to find it, and
    fall back to searching / reusing the previous story as a model.

Expected Behavior

*draft deterministically loads .aiox-core/product/templates/story-tmpl.yaml
every time, with no search/guess fallback, regardless of which IDE or which
agent file drives the session.

Fix (single, deterministic): declare the dependency with an explicit
relative path and honor explicit paths verbatim in resolution.

In .aiox-core/development/agents/sm.md:
dependencies.templates:
- product/templates/story-tmpl.yaml # was: story-tmpl.yaml

And update the IDE-FILE-RESOLUTION note:
"Dependencies containing an explicit path separator are used verbatim,
relative to .aiox-core/. Only bare filenames fall back to the
.aiox-core/development/{type}/{name} mapping."

Why this is correct:

  • Deterministic: a literal path is loaded; the agent never searches.
  • Root cause: the single-folder mapping cannot represent templates split
    between development/ and product/; explicit paths remove the ambiguity.
  • Propagates to every IDE: the source agent is what the installer/generator
    uses to emit .claude/agents/aiox-sm.md, .codex/agents/..., so fixing the
    source makes the two agent files agree and removes the intermittency.

Actual Behavior

The source SM agent resolves the story template to
.aiox-core/development/templates/story-tmpl.yaml (which does not exist),
resolution fails, and the LLM falls back to searching and/or reusing the
previous story as a template — producing inconsistent story structure.
The native subagent .claude/agents/aiox-sm.md points to the correct
product/templates path, so the outcome depends on which agent file is
active (intermittent).

Error Output

No stack trace. Observable resolution mismatch:

  Declared dependency (sm.md):     templates/story-tmpl.yaml
  Generic mapping (sm.md line 12): .aiox-core/development/{type}/{name}
  Resolved to:                     .aiox-core/development/templates/story-tmpl.yaml   [MISSING]
  Actual location:                 .aiox-core/product/templates/story-tmpl.yaml       [EXISTS]
  Native subagent (aiox-sm.md:60): .aiox-core/product/templates/  [correct]

Affected Area

Core Framework (.aiox-core/core/)

AIOX Version

5.3.0

Operating System

Windows 10

Node.js Version

22.18.0

Priority

High - Significant impact on functionality

Checklist

  • I have searched existing issues to avoid duplicates
  • I have tested with the latest version
  • I can consistently reproduce this issue

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: coreCore framework (.aios-core/core/)area: installerInstaller and setup (packages/installer/)status: needs-triageAwaiting initial triagetype: bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions