Skip to content

fix(framework): a file written through the shell belongs to no task #692

Description

@blafourcade

Context

Task attribution derives a task from the file_written lines the run journal records. The journal reads a written path out of the host's own hook payload, and WRITTEN_PATH_EXTRACTOR_BY_HOST knows Claude Code's Write, Edit and NotebookEdit.

Found by

A live headless Claude Code session, run against the plugin loaded with --plugin-dir. Asked to create a file inside a task folder, the model did not use Write:

TOOL_USE: Bash {"command": "mkdir -p …/2026_08_21_live && printf 'probe' > …/notes.md"}

The journal recorded session_start and turn_end and no file_written. The session's tokens were measured in full — 77,412, verified by hand against the transcript — and it belongs to no task.

No fixture could have surfaced this: every captured payload in scripts/__tests__/fixtures uses the file tools, so every test asserted the path that does work.

Expected

A file written into a task folder is attributed to that task, however the tool chose to write it.

Actual

Bash carries a command string, not a path, so the write is invisible. The same is true of Codex, which writes through apply_patch — this is the same gap reaching a second tool.

Scope

  • Whether a written path can be recovered from a shell command at all, and at what cost in false positives. A command mentioning a path is not a command that wrote it, and attributing on a mention would invent a task.
  • Whether PostToolUse offers anything better than the command string — a changed-files list, an exit status with paths.
  • If neither: state it as a limit rather than closing it. It is already written down in docs/telemetry-limits.md.

Not in scope: guessing. A task attributed from a path that merely appeared in a command is worse than no task.

Relations

Field Value
parent #631
related #691, #690

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    Status
    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions