Skip to content

fix: AI mode generates unwanted commit changelog in README_AI.md #30

@dreamlx

Description

@dreamlx

Problem

When using codeindex scan --ai, the AI (LLM) spontaneously appends commit changelog sections to the generated README_AI.md, even though this is not part of the design intent.

Example: src/codeindex/README_AI.md contains ~60% noise from empty commit entries (lines 126-262):

**Commit ``**: 

Changed files:
- `smart_writer.py`

**Commit ``**: 

Changed files:
- `parser.py`

Root Cause

  • SmartWriter's structural generators (overview/navigation/detailed) do not include any git log/commit logic
  • The commit information is added by the LLM during AI-mode generation — it over-interprets the prompt and adds changelog content on its own
  • This is confirmed by comparing:
    • src/README_AI.md (structural mode, (navigation) tag) → clean, no commit info
    • src/codeindex/README_AI.md (AI mode, no mode tag) → polluted with commit changelog

Impact

  • Wastes ~60% of README_AI.md token budget on noise
  • Commit info is redundant — git log already provides this
  • Degrades AI agent experience when reading README_AI.md for code understanding

Expected Action

Add explicit constraints in the AI prompt to prevent LLM from generating commit history, changelog, or "Recent Changes" sections. The prompt should instruct:

  • Only generate content based on the provided ParseResult (symbols, imports, structure)
  • Do NOT add git commit history, changelog, or recent changes sections
  • Do NOT fabricate information not present in the input data

Discovered During

Dogfooding / brainstorm session on README_AI.md organizational structure (2026-03-12).

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions