iOfficeAI / iOfficeAI/AionCore

[Bug] Assistant rule (preset_context) not injected into spawned team teammates - claude backend gets title line only, antigravity gets nothing (3 cohorts, latest 2026-08-31)

Open
#953 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
105
Forks
169
Avg merge
5h 58m
Merged PRs (30d)
84

Description

### Module

Team / Agent spawn — assistant rule (`preset_context`) injection

### Platform

Windows 11 (desktop app), backends: ACP (claude) and antigravity (agy)

### AionCore Version

aioncore 0.1.72 (AionUi desktop build)

---

### Bug Description

When a custom assistant that carries a complete rule body is spawned as a **team teammate**, the rule text does not reach the runtime, although the config layer holds it in full.

- **claude (ACP) backend**: the teammate reports seeing only the rule's first title line; the entire body is missing.
- **antigravity (agy) backend**: no role/position section at all — neither title nor body.

The config side is verifiably complete: reading the live config with `config assistants rule read` returns 2500–2900 bytes per assistant in every case below. The loss happens between config and runtime, i.e. at spawn.

This is not a cosmetic issue for team use: a teammate without its rule has no role boundary. We have a concrete role-displacement sample (below).

### Config vs runtime (same cohort, probed at runtime by each teammate)

| Assistant | assistant_id | Backend | `rules.content` in config | Seen at runtime |
|---|---|---|---|---|
| Content Director | `custom-1786189052747-aeb5` | claude | 2844 bytes | title line only |
| Visual Asset Specialist | `custom-1786189156670-d315` | claude | 2574 bytes | title line only |
| Lead Researcher | `custom-1786189116442-e8e5` | antigravity | 2717 bytes | no role section |
| Audio/Video Producer | `custom-1786189204241-a8c5` | antigravity | 2575 bytes | no role section |

Assistant display names above are translated to English; `assistant_id` values are as-is.

### Reproduction of the symptom across three separate cohorts

1. **2026-08-13** — first recorded in a content team ledger: same symptom, rule loaded only to the title line.
2. **2026-08-27** — reproduced on the four assistants in the table above (two backends).
3. **2026-08-31 (new)** — see "Still reproducible today" below.

### Still reproducible today, plus a working workaround (new evidence, 2026-08-31)

A teammate spawned **today** on the antigravity backend (model `gemini-3.7-flash-high`) again could not read its assistant rule.

- The team lead applied a workaround: write the same rule text into the workspace file `.agents/AGENTS.md`.
- After that file existed, the rule took effect.
- Loading was **verified by asking the teammate to recite the rule text verbatim** — it reproduced the rule body, which it could not do before the workaround.

This confirms two things that should help locate the defect:

1. The **agy path is still not fixed** as of aioncore 0.1.72 — this is not a stale report.
2. A **filesystem-based rule channel works** where the injected one does not, which suggests the loss is in the spawn-time injection/composition step rather than in the model's ability to consume the rule.

### Impact sample: role displacement

One assistant (claude backend, reviewer role) with its rule not loaded opened project-level files aimed at the *lead* role to fill the gap, and self-described its own duty in lead wording ("I only judge / gate / decide") — i.e. it adopted the wrong role from the wrong source. It acknowledged the displacement after follow-up. Silent rule loss therefore does not merely degrade style, it moves agents across role boundaries.

### What we traced in the code (hypothesis, not a claim)

We are reporting first-hand symptoms; the following is only where our own reading pointed, offered in case it saves time:

- `crates/aionui-ai-agent/src/capability/first_message_injector.rs` composes `[Assistant Rules]\n{preset_context}\n[/Assistant Rules]`, and the comment there notes `Argv` / `Protocol` delivery is LIGHT (only `preset_context`), while `Injected` adds the skills index.
- `crates/aionui-session/src/backend/antigravity/argv.rs` carries `injected_prefix` and documents that it is prepended **on the first invocation only** (agy re-spawns `-p` per turn and resumes with `--conversation`, and a resumed invocation deliberately does not re-inject). If the "first invocation" for a team member is consumed by something other than the wake turn — or if the team path never populates the prefix — the block would never arrive at all. That matches the "no role section at all" outcome on agy.
- Grepping the team crate, we found **no** reference to `preset_context`, `rules` or `injected_prefix` in `crates/aionui-team/src/member_runtime.rs`, `provisioning.rs` or `prompt_dump.rs`, and `crates/aionui-team/src/event_loop.rs` submits `content: input.first_message` as the turn content. So we could not find where a team member's first turn picks up the assistant rule.

Please treat this as "we could not find the path" rather than "we proved it is missing" — the runtime evidence above is what we actually observed.

### Expected Behavior

1. A spawned team teammate should run with the assistant's **full** `rules.content`, on every backend.
2. If injection is impossible or incomplete for a given backend, the platform should emit a **detectable signal** (log line / error / status field) instead of silently truncating or dropping, so teams can detect it and apply a fallback.
3. If rules genuinely travel first-message-only, it would help to document that contract, since "first message" has different meanings in a team wake than in a normal chat.

### Suggested verification aid

We noticed `crates/aionui-team/src/prompt_dump.rs` and `crates/aionui-ai-agent/src/dev_prompt_dump.rs`. If there is a supported way to dump the composed prompt actually sent for a **team member**, we can produce an exact payload diff (config rule bytes vs dumped first message) on request — please point us at the flag.

### Environment

- AionUi desktop + bundled aioncore 0.1.72, Windows
- Team spawn of `custom-*` assistants, rule `storage_mode=user_file`
- Backends involved: ACP (claude) and antigravity; injection behaviour appears backend-specific

---

### 中文摘要(Chinese summary)

自定义助手配置层 rule 完整(`config assistants rule read` 直读 2500–2900 字节),但作为 team 队友 spawn 后运行时拿不到:**claude 后端只剩标题行,antigravity 后端整段不注入**。跨三届复现(2026-08-13 / 08-27 / 08-31)。

**今日新增证据**:2026-08-31 新孵化的 agy 队友(`gemini-3.7-flash-high`)同样读不到岗位 rule;领队把同一份 rule 文本写入工作区 `.agents/AGENTS.md` 后生效,并以「让队友背出 rule 原文」验证加载成功。这说明 agy 侧至今未修,且基于文件系统的 rule 通道可用——问题应在 spawn 时的注入/组装环节,不在模型侧。

已造成角色错位实锤:某 claude 后端审阅岗在 rule 未上身时去读领队岗规则填空,自述成领队职责口径。

代码侧仅为我们的定位猜测:注入由 `first_message_injector.rs` 组合,agy 侧 `argv.rs` 注明「仅首次调用注入、续接不重注入」,而我们在 `aionui-team` crate 内没有找到队友首轮取用 rule 的路径(`event_loop.rs` 直接提交 `content: input.first_message`)。请按「我们没找到路径」而非「我们断定缺失」看待。

诉求:①队友应拿到完整 rule,与后端无关;②注入不完整时必须给出可检测信号,不要静默截断;③若 rule 确实只随首条消息注入,请把这个契约写进文档(team 唤醒场景下「首条消息」语义与普通会话不同)。

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with crates/aionui-ai-agent/src/capability/first_message_injector.rs and crates/aionui-session/src/backend/antigravity/argv.rs, then trace the team entry points in crates/aionui-team/src/event_loop.rs, member_runtime.rs, provisioning.rs, and prompt_dump.rs. Compare the composed first message with the team member spawn path for both backends. Done means the full rules.content reaches spawned teammates on each backend, or incomplete injection produces a detectable signal.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
ai-infra-agents, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.