#18110: enhance: elevate special context files (soul.md, identity.md, user.md, memory.md) into dedicated prompt sections
agents
size: S
Cluster:
Soul Hooks Security Enhancements
Closes #17810
Elevates `soul.md`, `identity.md`, `user.md`, and `memory.md` out of the flat `# Project Context` list into dedicated sections (`## Doctrine`,` ## Identity`, `## User Context`, `## Memory`) with scoped preambles. Non-special files render in Project Context as before; elevated files are filtered out to save tokens.
Running in production since 2026.2.3 across all releases up to and including 2026.2.15 with zero conflicts or regressions.
See issue #17810 for full design rationale and patch documentation.
**AI Disclosure:** This patch was developed with AI assistance (Claude) for code review, syntax fixes, type safety refinements, and documentation.
<!-- greptile_comment -->
<h3>Greptile Summary</h3>
This PR elevates four special context files (`soul.md`, `identity.md`, `user.md`, `memory.md`) from the flat `# Project Context` list into dedicated sections with descriptive names (`## Doctrine`, `## Identity`, `## User Context`, `## Memory`) and scoped preambles for soul.md and identity.md. Non-special files continue to render in `# Project Context` as before. The implementation correctly:
- Uses case-insensitive, normalized path matching to identify special files
- Handles duplicate special files by keeping only the first occurrence
- Filters all special files (including duplicates) out of the `# Project Context` section using `Map.has()`
- Renders special sections in deterministic order
- Includes comprehensive test coverage validating the new behavior including duplicate suppression
The change has been running in production since 2026.2.3 with no reported issues.
<h3>Confidence Score: 5/5</h3>
- This PR is safe to merge with no significant risk
- The implementation is clean, well-tested, and has been validated in production for 12+ days across multiple releases. The logic correctly handles edge cases (duplicates, case sensitivity, path normalization), and the test suite validates all key behaviors including duplicate suppression. The previous thread's concern has already been resolved by the current implementation.
- No files require special attention
<sub>Last reviewed commit: ab61cb3</sub>
<!-- greptile_other_comments_section -->
<!-- /greptile_comment -->
Most Similar PRs
#11169: fix(security): remove bundled soul-evil hook that enables silent ag...
by liuxiaopai-ai · 2026-02-07
70.5%
#11048: fix: address repository issues (env, author, CI comments, security ...
by cavula · 2026-02-07
70.2%
#14018: fix: auto-remind AI to check workspace context files on session reset
by WalterSumbon · 2026-02-11
70.0%
#9628: fix: resolve tsconfig rootDir errors by separating UI config (AI-as...
by KGBos · 2026-02-05
69.1%
#17938: feat(workspace): Add GOALS.md and SOUVENIR.md for behavioral anchors
by ibrahimq21 · 2026-02-16
68.6%
#12701: security: prefix bare .md file references with ./ to prevent TLD re...
by sypsyp97 · 2026-02-09
68.5%
#10831: fix(agents): set Opus 4.6 context window to 1M in forward-compat fa...
by slawt · 2026-02-07
68.4%
#20267: feat: workspace-aware post-compaction context
by nickjlamb · 2026-02-18
68.2%
#18616: agents: add bootstrap retrieval mode to reduce prompt overhead
by Duartemartins · 2026-02-16
68.1%
#21217: fix: memory prune command to prevent unbounded MEMORY.md growth
by theognis1002 · 2026-02-19
68.1%