agentscope-ai / agentscope-ai/QwenPaw

[Feature]: Add a config toggle to opt out of the hardcoded "About" identity line in env_context

未关闭
#7,540 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
enhancement
主要语言
Python
星标
34.9k
派生
3.1k
平均合并
1 天 15 小时
30 天内合并 PR
225

描述

## Summary

`build_env_context()` unconditionally injects a hardcoded identity line (`- About: You are a personal AI assistant, powered by {model}. ...`) into the system prompt of every request. I'd like a config toggle (default = current behavior) so agents with custom personas defined in SOUL.md / PROFILE.md can opt out and fully own their system prompt.

## Component(s) Affected

- [x] Core / Backend (app, agents, config, providers, utils, local_models)
- [ ] Console (frontend web UI)
- [ ] Channels (DingTalk, Feishu, QQ, Discord, iMessage, etc.)
- [ ] Skills
- [ ] CLI
- [ ] Documentation (website)
- [ ] Tests
- [ ] CI/CD
- [ ] Scripts / Deploy

## Problem / Motivation

QwenPaw's persona system (AGENTS.md / SOUL.md / PROFILE.md) is great, but the environment context block built in `src/qwenpaw/app/chats/utils.py` always prepends this fixed line on top of it:

```
- About: You are a personal AI assistant, powered by . You operate in QwenPaw, an open-source agent framework built by AgentScope team from Qwen lab.
```

For agents whose identity is carefully crafted in persona files, this hardcoded line sits near the top of every request's system prompt and competes with the persona. Persona files can override it behaviorally, but the line remains physically present in every payload.

Interestingly, QwenPaw itself already contains a regex in the visual-compression pipeline (`src/qwenpaw/agents/context/visual_compression/pipeline/static_context.py:48`) whose whole job is to match and strip exactly this About block — which suggests the line does leak into contexts where it isn't wanted.

Who benefits: persona-heavy setups, multi-agent deployments where each agent should carry a distinct identity, and anyone wanting a minimal system prompt (also marginally fewer tokens).

## Proposed Solution

Add an opt-out flag with backward-compatible default, e.g. in `config.json`:

```json
{
"env_context": {
"show_about_line": true
}
}
```

Happy to align the key name with existing config conventions. Implementation is tiny: the About line is assembled from three string constants in `build_env_context()` (`- About: You are a personal AI assistant` + `, powered by {model}` + `. You operate in QwenPaw...`), so gating that single line behind the flag is a ~few-line change, plus a unit test asserting the line appears by default and disappears when disabled.

## Alternatives Considered

1. **Suppress via persona files** — works behaviorally, but the line is still physically sent in every payload; personas shouldn't have to fight the harness.
2. **Strip it downstream** (as the visual-compression regex already does for its own path) — fixes one consumer while the actual LLM request still receives it.
3. **Remove the line entirely** — not what I want: it's useful attribution for default agents, hence a toggle instead.

Side note: a stable (or shorter) env block would also marginally help LLM prefix-cache stability, cf. #6953.

## Additional Context

- Reproduced and verified on QwenPaw 2.1.0 (Desktop, Windows): the assembled line appears verbatim in the agent's system prompt.
- Code path confirmed against current `main`: `src/qwenpaw/app/chats/utils.py:182` (`f"- About: You are a personal AI assistant{powered}. "`).
- Happy to provide a raw payload dump if useful for discussion.

## Willing to Contribute

- [x] I am willing to open a PR for this feature (after discussion).

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。