Algorithm v3.7.0: require Edit-append for PRD body expansion#1063
Open
Resistor52 wants to merge 1 commit intodanielmiessler:mainfrom
Open
Algorithm v3.7.0: require Edit-append for PRD body expansion#1063Resistor52 wants to merge 1 commit intodanielmiessler:mainfrom
Resistor52 wants to merge 1 commit intodanielmiessler:mainfrom
Conversation
Add a MANDATORY paragraph to the PRD stub section instructing the AI to expand PRD bodies via Edit-append rather than a single monolithic Write. Single-shot Write calls for long prose content can be truncated mid-parameter by the tool-call wrapping layer, leaving the file as a frontmatter-only stub on disk while the model believes the content landed. This was documented in two separate incidents in a single day; both produced 10-line frontmatter stubs and a pattern/report that never reached disk. The new paragraph specifies: 1. The initial stub Write is the ONLY single-shot Write of the PRD. 2. Every subsequent body section (Context, Criteria, Decisions, Verification, subsections) uses its own Edit call capped at about 200 lines of new content. 3. After any Write or Edit landing more than 50 lines of new prose, immediately Read the first and last 10 lines to confirm the content is on disk (tool-call channel can silently fail). 4. Never embed literal closing-tag strings for system-injected XML (function_calls, parameter, invoke, system-reminder) in PRD content; use HTML entities or paraphrase. Those strings can confuse the tool-call parser and terminate the parameter early. This is a universal PAI Algorithm improvement, not specific to any downstream customization. The root cause lives in the tool-call channel reliability envelope that every PAI user on any LLM harness can hit. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a MANDATORY paragraph to the PRD stub section of
Releases/v4.0.3/.claude/PAI/Algorithm/v3.7.0.mdinstructing the AI to expand PRD bodies via Edit-append rather than a single monolithic Write.Single-shot Write tool calls for long prose content can be truncated mid-parameter by the tool-call wrapping layer, leaving the PRD as a 10-line frontmatter-only stub on disk while the model believes the full body landed. I hit this twice in one day, in completely separate sessions, on completely separate tasks. Both times the failure signature was identical: "malformed closing tag" in the post-run learning log, content visibly in working memory during the run, but nothing beyond frontmatter actually written to the file.
This is a universal Algorithm issue, not specific to any downstream customization. The root cause lives in the tool-call channel reliability envelope that every PAI user on any LLM harness can hit when writing long content in a single Write call.
What this PR changes
One file, one paragraph inserted:
Releases/v4.0.3/.claude/PAI/Algorithm/v3.7.0.mdat line 144 (right after the PRD stub frontmatter block, right before the Console output MANDATORY paragraph)The new paragraph specifies four concrete rules:
How this was discovered
This fix was produced by running my local PAI Algorithm's own analysis process against two same-day incidents, using the TRACE-style framework (Trigger, Reverse, Analyze, Categorize, Extract). The full methodology for this kind of AI self-learning-from-mistakes is documented here:
Teaching My AI to Learn from Its Mistakes: https://kennethghartman.com/blog/teaching-my-ai-to-learn-from-its-mistakes/
The blog post explains the local process that generated this fix: detect the failure, enumerate prior occurrences, run a 5-level Why analysis, propose a correction, get approval, implement, and preserve the rule in long-term memory. Credit to the process; the paragraph here is one of its outputs.
Compatibility
Pure additive change. Two lines inserted. No existing text removed or reflowed. Downstream forks that have customized the PRD stub section will not see a conflict unless they have also added a paragraph in the same location.
Testing