mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-17 08:00:59 +00:00
Add reference to #330 (Dynamic Context Pruning) in plan
Documents why context event was added and notes the type inconsistency between ContextEvent (AgentMessage[]) and ContextEventResult (Message[])
This commit is contained in:
parent
ae614f93e3
commit
bbdc350394
1 changed files with 18 additions and 5 deletions
|
|
@ -287,19 +287,32 @@ Benefits:
|
||||||
|
|
||||||
### Investigate: `context` event vs `before_agent_start`
|
### Investigate: `context` event vs `before_agent_start`
|
||||||
|
|
||||||
Reference: [#324](https://github.com/badlogic/pi-mono/issues/324)
|
References:
|
||||||
|
- [#324](https://github.com/badlogic/pi-mono/issues/324) - `before_agent_start` proposal
|
||||||
|
- [#330](https://github.com/badlogic/pi-mono/discussions/330) - Dynamic Context Pruning (why `context` was added)
|
||||||
|
|
||||||
**Current `context` event:**
|
**Current `context` event:**
|
||||||
- Fires before each LLM call within the agent loop
|
- Fires before each LLM call within the agent loop
|
||||||
- Receives `AgentMessage[]` (deep copy, safe to modify)
|
- Receives `AgentMessage[]` (deep copy, safe to modify)
|
||||||
|
- Returns `Message[]` (inconsistent with input type)
|
||||||
- Modifications are transient (not persisted to session)
|
- Modifications are transient (not persisted to session)
|
||||||
- No TUI visibility of what was changed
|
- No TUI visibility of what was changed
|
||||||
- Use case: non-destructive pruning, dynamic context manipulation
|
- Use case: non-destructive pruning, dynamic context manipulation
|
||||||
|
|
||||||
**Problem:** `AgentMessage` includes custom types (hookMessage, bashExecution, etc.) that need conversion to LLM `Message[]` before sending. Need to verify:
|
**Type inconsistency:** Event receives `AgentMessage[]` but result returns `Message[]`:
|
||||||
- [ ] Where does `AgentMessage[]` → `Message[]` conversion happen relative to `context` event?
|
```typescript
|
||||||
- [ ] Should hooks work with `AgentMessage[]` or `Message[]`?
|
interface ContextEvent {
|
||||||
- [ ] Is the current abstraction level correct?
|
messages: AgentMessage[]; // Input
|
||||||
|
}
|
||||||
|
interface ContextEventResult {
|
||||||
|
messages?: Message[]; // Output - different type!
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Questions:
|
||||||
|
- [ ] Should input/output both be `Message[]` (LLM format)?
|
||||||
|
- [ ] Or both be `AgentMessage[]` with conversion happening after?
|
||||||
|
- [ ] Where does `AgentMessage[]` → `Message[]` conversion currently happen?
|
||||||
|
|
||||||
**Proposed `before_agent_start` event:**
|
**Proposed `before_agent_start` event:**
|
||||||
- Fires once when user submits a prompt, before `agent_start`
|
- Fires once when user submits a prompt, before `agent_start`
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue