Skip to content

update.md prints the whole detect_incremental result to stdout, flooding the agent's context #3944

Description

@jnrod03-rgb

The first code block of "For --update" in references/update.md (unchanged
through v0.9.72, line 17) both persists and prints the incremental detection
result:

result = detect_incremental(Path('INPUT_PATH'))
new_total = result.get('new_total', 0)
print(json.dumps(result, indent=2, ensure_ascii=False))
Path('graphify-out/.graphify_incremental.json').write_text(json.dumps(result, ensure_ascii=False), encoding="utf-8")

The result carries every file path in the corpus (files) plus the changed
subset (new_files). On a ~940-file corpus that print was roughly a thousand
indented paths.

Why it matters in this skill specifically: the reader of that stdout is not a
person scrolling a terminal, it is the agent's context window. Every later step
already reads .graphify_incremental.json from disk, so the print duplicates
the most verbose artifact of the pipeline into the scarcest resource, at the
start of a flow that still has to dispatch subagents and run the merge.

It also contradicts the full build. Step 2 of SKILL.md handles the
equivalent detect() result with an explicit "Do NOT cat or print the JSON",
followed by a short per-category summary. The incremental path is the only one
that dumps it.

Observed vs expected: observed, a full JSON dump of every path. Expected,
only what the next decision depends on, with the data left on disk, the same
as Step 2.

Proposal: replace the dump with a summary, keeping the sidecar write as is:

nf = result.get('new_files', {})
print(json.dumps({
    'new_total': new_total,
    'deleted': len(result.get('deleted_files', [])),
    'new_by_type': {t: len(v) for t, v in nf.items()},
    'total_files': result.get('total_files'),
    'total_words': result.get('total_words'),
    'skipped_sensitive': result.get('skipped_sensitive', []),
}, indent=2, ensure_ascii=False))
print('Full result: graphify-out/.graphify_incremental.json')

I ran the whole --update flow with this substitution and every later step
behaved identically, since none of them read stdout.

The same pattern may be worth a pass elsewhere in the generated skills: any
block that writes a sidecar and also prints it in full.

Environment: observed on graphifyy 0.9.55, graphify install --platform claude,
Claude Code on Windows 11; now on 0.9.65. Block checked unchanged in v0.9.72.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions