agentscope-ai / agentscope-ai/QwenPaw

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

Abierto Apto para principiantes
#7,540 1 comentario 0 reacciones 0 asignados Ver en GitHub
enhancement
Lenguaje dominante
TypeScript
Estrellas
35k
Forks
3.1k
Merge medio
1 d 13 h
PR fusionados (30 d)
228

Descripción

## 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).

Guía de contribución

Abrir la guía de contribución

Línea de trabajo

Start in src/qwenpaw/app/chats/utils.py at build_env_context(), especially the About line assembled around line 182, then inspect the existing configuration-loading conventions. Verify that the current default still includes the line and that disabling the proposed setting omits it, using a unit test as described in the issue.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
python
Área
backend
Tipo de issue
Nueva funcionalidad
Dificultad
2/5
Tiempo estimado
1-3 horas
Estado de actividad
Activo
Claridad
Bien especificado
Aptitud para principiantes
82/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.