feat: avoid duplicate project-map hint injection by checking context
The before_agent_start handler now inspects the current session context and skips injection if a pi-project-map-hint custom message is already present in the active branch. This prevents duplicate hints on every prompt while still re-injecting after compaction or tree navigation. Also removes the unused hooks/on-prompt.ts prompt-text injector.
This commit is contained in:
+2
-3
@@ -291,8 +291,6 @@ pi-project-map/
|
||||
│ ├── merge.ts # Merge AST + LLM outputs
|
||||
│ ├── format.ts # Dense markdown formatter
|
||||
│ └── config.ts # Skill configuration (thresholds, ignore patterns)
|
||||
├── hooks/
|
||||
│ └── on-prompt.ts # Injects maintenance command into prompts
|
||||
└── README.md # Setup and usage for humans
|
||||
```
|
||||
|
||||
@@ -303,8 +301,9 @@ pi-project-map/
|
||||
- `project-map:reinit [path]` — Force re-initialization of entire project or subtree.
|
||||
|
||||
### Prompt Hook
|
||||
- On every prompt, the skill appends a lightweight instruction:
|
||||
- On each prompt, the skill injects a lightweight custom message **only if it is not already present in the current branch of context**:
|
||||
> "If you modify any source file, run `project-map:patch <path>` to update the analysis. If you suspect staleness, run `project-map:validate`."
|
||||
- The extension checks `ctx.sessionManager.buildSessionContext()` for an existing `pi-project-map-hint` custom message and skips injection when one is found. This prevents duplicate hints after steering, follow-up messages, or multi-turn conversations. The hint is automatically re-injected after compaction or `/tree` navigation removes it from the active path.
|
||||
|
||||
## 9. Risks and Tradeoffs
|
||||
|
||||
|
||||
Reference in New Issue
Block a user