# 🚀 CodeBuddy Code v2.82.0 Release

## ✨ New Features

### Fork Subagent

The Agent tool now supports Fork mode: when the `subagent_type` parameter is omitted, it automatically creates a background subagent that inherits the parent agent's full context (system prompt, tool set, conversation history). This is ideal for parallel task scenarios that require the current conversation context, without the need to manually pass context information.

### Conversation Branching

Added `/fork` and `/branch` slash commands to support creating branches at the current conversation position. Branches copy the active conversation history to a new session and automatically switch to it. You can return to the original conversation via `/resume` to continue working.

## 🔧 Improvements

- **Memory injection optimization**: Auto Memory context injection moved from the end to the first message, improving prompt cache hit rate; added fallback detection to ensure memory is not lost after resume
- **SystemReminder streamlining**: Removed TODO-LIST auto-injection logic to reduce unnecessary context usage
- **Trace logging**: Added traceId/spanId logging at request entry and TraceStartHook for easier troubleshooting of trace-related issues
- **Plugin agent configuration enhancement**: Agent configuration in plugin `settings.json` is no longer restricted by the enabled state, supporting independent `settings.json` file loading of agent definitions
- **Settings agent override optimization**: Both `settings.agent` and plugin agents now use patch-in-place to override default agents, keeping agent names unchanged
- **CLI `--agent` parameter**: Added the `--agent` command-line parameter to directly specify the agent for a session at startup, taking priority over settings configuration

## 🐛 Bug Fixes

- **File lock PID check**: File locks can now be reclaimed immediately after a process crash, no longer requiring a 5-minute timeout
- **Settings write degradation**: Graceful degradation when file lock acquisition fails, no longer throwing unhandled exceptions
- **Background session attach**: The `attach` command now prioritizes tracking log output for sessions started with `--bg`
- **Short command exit**: Commands like `ps/logs/attach/kill` now exit immediately after execution instead of hanging
- **Headless routing**: Fixed an issue where `--output-format=stream-json` style equal-sign format parameters could not be correctly routed to the headless bundle
- **MCP OAuth authentication**: Fixed an authentication failure caused by mismatched OAuth callback paths
- **Bedrock model compatibility**: Fixed an error with the Bedrock ConverseStream API when message content was empty
- **stream-json error output**: Fixed an issue where exception information polluted the JSON stream in stream-json mode; errors are now output in JSON format
