aws-samples / aws-samples/remote-swe-agents

feat: Add ability to clear conversation history within the same session

Open
#358 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
TypeScript
Stars
243
Forks
50
Avg merge
1h 19m
Merged PRs (30d)
24

Description

## Feature Request

Add the ability to clear/reset conversation history within the same EC2 instance session without starting a new session.

## Use Case

When working on a long session, the conversation history can grow large and may include outdated context that is no longer relevant. Users may want to:

1. Clear history to start fresh with a new task on the same instance
2. Reset context when switching to a different topic
3. Reduce token usage by removing irrelevant historical messages

## Current Behavior

- Conversation history is stored in DynamoDB and persists for the entire session
- No way to clear history without starting a new session (new EC2 instance)
- Existing Slack commands: `approve_user`, `dump_history`, `take_over` - none for clearing

## Proposed Solution

### Option A: Slack Command
Add a `clear_history` command that clears all messages for the current thread/session.

```
@remote-swe clear_history
```

### Option B: Web UI Button
Add a "Clear History" button in the session page UI.

### Option C: Both
Implement both Slack command and Web UI button for flexibility.

## Implementation Considerations

- Should preserve session metadata (repo info, etc.) while clearing messages
- May need confirmation prompt to prevent accidental clearing
- Could optionally keep the last N messages or system context
- Need to handle the case where agent is currently processing

## Related Files

- `packages/slack-bolt-app/src/app.ts` - Slack command handlers
- `packages/agent-core/src/lib/messages.ts` - Message storage (needs delete function)
- `packages/webapp/src/app/sessions/[workerId]/actions.ts` - Web UI actions

Contributor guide

Open the contributing guide

Research direction

Start by reading packages/slack-bolt-app/src/app.ts, packages/agent-core/src/lib/messages.ts, and packages/webapp/src/app/sessions/[workerId]/actions.ts to compare the existing command and session-action flows. Define the clearing behavior and confirmation requirements, then verify that messages can be removed while session metadata is preserved and active processing is handled safely.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
full-stack
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.