[GH-ISSUE #5945] [Feature]: Custom agent output feedback loop / self managed context #3287

Closed
opened 2026-10-21 06:01:41 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @usagirei on GitHub (Sep 8, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/5945

Originally assigned to: @SpicyMarinara on GitHub.

What problem does this solve?

Custom Agents seemingly can't read their own output from previous turns

The {{agent::<type>}} macro returns empty when used in their own prompt template

Proposed solution

Add a Context source for custom agents, containing output from its previous iteration.

This lets the custom agent have its own isolated context sandbox, which can still be fed to the main prompt through markers if needed.

This would empower custom agents to manage things like: dnd character stat sheets, self reminders for the next turn(s), etc

It would likely need to be tracked in game state like persona stats, inventory, etc

Alongside, a way for non context injection agent outputs (JSON) to also include an agent-context field, and retain that as context input to the next iteration.
Some form of determining what is kept as self context and what is exposed as a marker to the main model would be useful too, like a separate context injection mode that accepts json and only injects one field, like above.

Optionally a toggle to spoiler/hide the agent output from direct user visibility unless intentionally done so, like the narrative director

Alternatives considered

Let custom agents target user defined lorebook entries (configured per chat) as context storage / backing
But this loses the ability of reverting changes upon message deletion / regeneration

Additional context

Including all matching lorebook entries generates a lot of unnecessary noise on the request, and doesn't include entry name, only ID
Lorebook editing capability doesn't let agents target specific entries by ID, only name which is not included when used as context input

Template check

Please uncheck (untick) the box below before submitting so we know you read the template. It is intentionally pre-checked:

  • I DID NOT read this template and provide the requested details.
Originally created by @usagirei on GitHub (Sep 8, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/5945 Originally assigned to: @SpicyMarinara on GitHub. ## What problem does this solve? Custom Agents seemingly can't read their own output from previous turns The `{{agent::<type>}}` macro returns empty when used in their own prompt template ## Proposed solution Add a Context source for custom agents, containing output from its previous iteration. This lets the custom agent have its own isolated context sandbox, which can still be fed to the main prompt through markers if needed. This would empower custom agents to manage things like: dnd character stat sheets, self reminders for the next turn(s), etc It would likely need to be tracked in game state like persona stats, inventory, etc Alongside, a way for non context injection agent outputs (JSON) to also include an agent-context field, and retain that as context input to the next iteration. Some form of determining what is kept as self context and what is exposed as a marker to the main model would be useful too, like a separate context injection mode that accepts json and only injects one field, like above. Optionally a toggle to spoiler/hide the agent output from direct user visibility unless intentionally done so, like the narrative director ## Alternatives considered Let custom agents target user defined lorebook entries (configured per chat) as context storage / backing But this loses the ability of reverting changes upon message deletion / regeneration <!-- Any other approaches you thought about? --> ## Additional context Including all matching lorebook entries generates a lot of unnecessary noise on the request, and doesn't include entry name, only ID Lorebook editing capability doesn't let agents target specific entries by ID, only name which is not included when used as context input <!-- Optional: mockups, related issues, references, or examples --> ## Template check Please **uncheck (untick)** the box below before submitting so we know you read the template. It is intentionally pre-checked: - [ ] I DID NOT read this template and provide the requested details.
Author
Owner

@SpicyMarinara commented on GitHub (Sep 8, 2026):

@SpicyMarinara (Codex) is handling this issue in the maintainer-requested Issue Sweep PR #5962. Existing implementation PRs, draft PRs and issue-linked branches were checked before starting. The fix will reuse existing code and include focused regression proof; this comment records ownership, not completion.

<!-- gh-comment-id:5585132567 --> @SpicyMarinara commented on GitHub (Sep 8, 2026): @SpicyMarinara (Codex) is handling this issue in the maintainer-requested Issue Sweep PR #5962. Existing implementation PRs, draft PRs and issue-linked branches were checked before starting. The fix will reuse existing code and include focused regression proof; this comment records ownership, not completion.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#3287
No description provided.