Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ We welcome contributions beyond standard feature or bug-fix PRs. Examples includ
| Prompts | `src/crates/assembly/core/src/agentic/agents/prompts/` | Add or refine prompts, and update related logic as needed |
| Tools | `src/crates/assembly/core/src/agentic/tools/implementations/`, `src/crates/assembly/core/src/agentic/tools/registry.rs` | Add tool implementations and register them in the tool registry |
| Subagents | `src/crates/assembly/core/src/agentic/agents/custom_subagents/`, `src/crates/assembly/core/src/agentic/agents/registry.rs` | Add subagent implementations and register them in the subagent registry |
| Mode contributions | `src/crates/assembly/core/src/agentic/agents/*_mode.rs`, `src/crates/assembly/core/src/agentic/agents/prompts/*_mode.md`, `src/web-ui/src/locales/*/settings/modes.json` | Add/improve agent modes (e.g. Plan/Debug/Agentic or custom modes) and keep prompts + UI copy in sync |
| Mode contributions | `src/crates/assembly/core/src/agentic/agents/*_mode.rs`, `src/crates/assembly/core/src/agentic/agents/prompts/*_mode.md`, `src/web-ui/src/locales/*/settings/modes.json` | Add/improve Agentic or custom modes and keep prompts + UI copy in sync |
| Scenario guides for Code Agent and AIIde | `website/src/docs/` | Add workflows, playbooks, and real-world scenario docs (or link them from `README.md`) |

### Before you start
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ DevTools;`Cmd/Ctrl + Shift + I` 切换 BitFun 元素检查器,`Cmd/Ctrl + Sh
| Prompts | `src/crates/assembly/core/src/agentic/agents/prompts/` | 新增或优化提示词,并按需更新相关逻辑 |
| Tools | `src/crates/assembly/core/src/agentic/tools/implementations/`、`src/crates/assembly/core/src/agentic/tools/registry.rs` | 新增工具实现,并在工具注册表中注册 |
| Subagents | `src/crates/assembly/core/src/agentic/agents/custom_subagents/`、`src/crates/assembly/core/src/agentic/agents/registry.rs` | 新增子代理实现,并在子代理注册表中注册 |
| 模式贡献 | `src/crates/assembly/core/src/agentic/agents/*_mode.rs`、`src/crates/assembly/core/src/agentic/agents/prompts/*_mode.md`、`src/web-ui/src/locales/*/settings/modes.json` | 新增/优化 Agent 模式(例如 Plan/Debug/Agentic 或自定义模式)的逻辑与提示词,并同步前端模式文案 |
| 模式贡献 | `src/crates/assembly/core/src/agentic/agents/*_mode.rs`、`src/crates/assembly/core/src/agentic/agents/prompts/*_mode.md`、`src/web-ui/src/locales/*/settings/modes.json` | 新增/优化 Agentic 或自定义 Agent 模式的逻辑与提示词,并同步前端模式文案 |
| Code Agent 与 AIIde 场景指南 | `website/src/docs/` | 补充流程、playbook 与真实场景说明(或从 `README.md` 链接) |

### 开始前
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Writes code, produces documents, and drives the desktop — with Mini Apps, a Ru
| --- | --- |
| **Agentic Mini Apps** | A task gets its own interface — chart, board, form, panel — with a conversation bound to that interface's live state |
| **Self-hosted multi-device control** | Login, cross-device session sync, and controlling one device from another run through a relay you deploy. Zero-knowledge; no vendor cloud in the path |
| **Coding** | Plan, edit, test, and commit inside real Git repositories. Agentic, Plan, Debug, Deep Review, long-horizon tasks |
| **Coding** | Plan, edit, test, and commit inside real Git repositories. Agentic, planning and debugging Skills, Deep Review, long-horizon tasks |
| **Office work** | Research, writing, presentations, meeting notes, reports |
| **Desktop execution** | Browser, terminal, desktop applications, the filesystem, and remote workspaces |
| **Four tiers of customization** | Custom Agents → MCP / Skills / Hooks → Mini Apps → source-level changes |
Expand Down Expand Up @@ -90,7 +90,7 @@ Two kinds of complex work: shipping code in real repositories, and turning sourc

| Scenario | Delivery goal | Typical capabilities |
| --- | --- | --- |
| **Coding** | Move from a real repository to a mergeable result. | Agentic, Plan, Debug, testing, Git, Deep Review, long-horizon tasks, and benchmarks. |
| **Coding** | Move from a real repository to a mergeable result. | Agentic, planning and debugging Skills, testing, Git, Deep Review, long-horizon tasks, and benchmarks. |
| **Office Work** | Move from source material to useful written and visual deliverables. | Research, presentations, summarization, writing, meeting notes, and reports. |

**Shared capabilities**
Expand Down
4 changes: 2 additions & 2 deletions README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
| --- | --- |
| **Agentic Mini App** | 为任务生成专属界面——图表、看板、表单、面板——对话绑定该界面的实时状态 |
| **自部署多设备互联互控** | 账号登录、跨设备会话同步、设备间操控,全部走你自己部署的 relay。零知识加密,不经第三方云 |
| **编码交付** | 在真实 Git 仓库里规划、改代码、跑测试、提交。Agentic、Plan、Debug、Deep Review、长程任务 |
| **编码交付** | 在真实 Git 仓库里规划、改代码、跑测试、提交。Agentic、规划与调试 Skill、Deep Review、长程任务 |
| **办公交付** | 调研、写作、演示文稿、会议纪要、报告 |
| **桌面执行层** | 浏览器、终端、桌面软件、文件系统、远程工作区 |
| **四层可定制** | 自定义 Agent → MCP / Skills / Hooks → Mini App → 源码级改造 |
Expand Down Expand Up @@ -90,7 +90,7 @@ pnpm run desktop:dev

| 场景 | 目标交付 | 典型能力 |
| --- | --- | --- |
| **编码** | 从真实仓库推进到可合并结果。 | Agentic、Plan、Debug、测试、Git、Deep Review、长程任务、Benchmark。 |
| **编码** | 从真实仓库推进到可合并结果。 | Agentic、规划与调试 Skill、测试、Git、Deep Review、长程任务、Benchmark。 |
| **办公** | 从资料推进到实用的文字和视觉交付物。 | 调研、演示文稿、总结、写作、会议纪要、报告。 |

**通用能力**
Expand Down
51 changes: 13 additions & 38 deletions docs/architecture/model-request-cache-reuse.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,49 +176,24 @@ and DeepReview retry fields.
That restriction is not just validation polish; it protects cache reuse by
keeping the forked child aligned with the parent session shape.

## 3. The Shared Coding Modes Intentionally Reuse The Same Cache Identity
## 3. Coding Workflows Keep The Agentic Cache Identity Stable

BitFun's four shared coding modes are:

- `agentic`
- `Plan`
- `debug`
- `Multitask`

They are intentionally configured to share the same stable prompt base.
`agentic` owns the stable coding prompt base. Planning and parallel task
coordination are built-in `plan` and `multitask` Skills rather than separate
Agent modes.

Relevant code:

- shared constants and tests:
- the Agentic prompt identity and coding profile facts:
`src/crates/execution/agent-runtime/src/agents.rs`
- mode definitions:
`src/crates/assembly/core/src/agentic/agents/definitions/modes/{agentic,plan,debug,multitask}.rs`

Why they reuse cache:

- all four modes use the same prompt template:
`SHARED_CODING_MODE_PROMPT_TEMPLATE = "agentic_mode"`
- all four modes use the same user-context policy:
`shared_coding_mode_user_context_policy()`
- `Agent::system_prompt_cache_identity(...)` is derived from
`prompt_template_name(...)`
- `Agent::user_context_cache_identity(...)` is derived from the user-context
policy scope key

The test `shared_template_modes_share_system_prompt_cache_identity()` asserts
that these shared modes intentionally produce the same system-prompt and
user-context cache identities.

Mode-specific behavior is added through `system_reminder` text, not by swapping
the cached base template:

- `Plan`, `Debug`, and `Multitask` provide first-entry and ongoing reminder
templates
- reminders are injected immediately before the current user message in
`ExecutionEngine::build_ai_messages_for_send(...)`

This is the key reason mode switches between these four coding modes do not
force a base prompt cache reset.
- the Agentic definition:
`src/crates/assembly/core/src/agentic/agents/definitions/modes/agentic.rs`
- built-in Skill catalog and mode policy:
`src/crates/execution/agent-runtime/src/skills/`

Skill availability and loading use the dynamic listing path described below.
Invoking a coding workflow therefore does not create another base Agent prompt
identity; only the dynamic Skill context changes.

The frontend also knows about this compatibility:

Expand Down
13 changes: 5 additions & 8 deletions docs/interactive-capabilities/capabilities.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"title": "BitFun Playbook",
"origin": "https://playbook.openbitfun.com",
"source": "src/shared/interactive-capabilities/catalog.json",
"digest": "b0794e2a65d5356a8fdb262f0acf26753ac1aebfedf9b1e252d4dce4a21bc9a1",
"digest": "5a170c4fb33ea5bb4fe1d839ff0d405db53b82e586aead0891babafbb59b40aa",
"ownerDigest": "a6a8c5337fb877e641b66f5774740d5213caed4800fe9b006eb53632f7eb1c2d",
"searchAcceptance": [
{
Expand Down Expand Up @@ -796,7 +796,6 @@
},
"delegateTools": [
"TodoWrite",
"CreatePlan",
"AskUserQuestion"
],
"presentationTarget": {
Expand Down Expand Up @@ -18525,15 +18524,14 @@
"kind": "delegate",
"tools": [
"TodoWrite",
"CreatePlan",
"AskUserQuestion"
],
"workflowZh": [
"复杂任务用 TodoWrite 维护当前进度,只有需要正式计划产物时才用 CreatePlan",
"复杂任务用 TodoWrite 维护当前进度;正式计划产物通过 Write 写入项目的 .bitfun/plans 目录",
"缺少会改变结果的用户选择时用 AskUserQuestion;能从仓库或当前上下文查明的信息不重复询问"
],
"workflowEn": [
"Use TodoWrite to maintain progress for complex work and CreatePlan only when a formal plan artifact is needed",
"Use TodoWrite to maintain progress for complex work; create formal plan artifacts with Write under the project's .bitfun/plans directory",
"Use AskUserQuestion only for a missing choice that changes the outcome; do not ask again for facts available from the repository or current context"
]
}
Expand Down Expand Up @@ -18703,11 +18701,10 @@
"Inspect the current goal with get_goal; create one with create_goal only when the user explicitly asks",
"Use update_goal complete only after the objective is achieved, and blocked only after the repeated-blocker threshold is genuinely met",
"TodoWrite",
"CreatePlan",
"AskUserQuestion",
"复杂任务用 TodoWrite 维护当前进度,只有需要正式计划产物时才用 CreatePlan",
"复杂任务用 TodoWrite 维护当前进度;正式计划产物通过 Write 写入项目的 .bitfun/plans 目录",
"缺少会改变结果的用户选择时用 AskUserQuestion;能从仓库或当前上下文查明的信息不重复询问",
"Use TodoWrite to maintain progress for complex work and CreatePlan only when a formal plan artifact is needed",
"Use TodoWrite to maintain progress for complex work; create formal plan artifacts with Write under the project's .bitfun/plans directory",
"Use AskUserQuestion only for a missing choice that changes the outcome; do not ask again for facts available from the repository or current context"
],
"docsUrl": "https://playbook.openbitfun.com/capabilities/feature.ai-assistant/"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Work with AI in project context, create sessions, continue tasks, answer permiss
- Inspect, create, complete, or block the current session goal
- **Agent 可定位入口,需交互完成 / Agent opens; interaction required** · 编辑目标说明或清除当前会话目标
- Edit the goal objective or clear the current session goal
- **由专用 Agent 工具控制 / Delegated Agent tool** · `TodoWrite` / `CreatePlan` / `AskUserQuestion` · 让 Agent 维护任务清单、生成实施计划并按需向用户提问
- **由专用 Agent 工具控制 / Delegated Agent tool** · `TodoWrite` / `AskUserQuestion` · 让 Agent 维护任务清单、生成实施计划并按需向用户提问
- Let an agent maintain a task list, produce an implementation plan, and ask the user when needed
- **Agent 可定位入口,需交互完成 / Agent opens; interaction required** · 查看单个会话的请求、Token 与成本用量报告
- View request, token, and cost usage for an individual session
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"schemaVersion": 1,
"generatedFrom": "src/shared/interactive-capabilities/catalog.json",
"catalogDigest": "b0794e2a65d5356a8fdb262f0acf26753ac1aebfedf9b1e252d4dce4a21bc9a1",
"catalogDigest": "5a170c4fb33ea5bb4fe1d839ff0d405db53b82e586aead0891babafbb59b40aa",
"count": 207,
"reasonCounts": {
"externalAuth": 4,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"schemaVersion": 2,
"generatedFrom": "src/shared/interactive-capabilities/catalog.json",
"catalogDigest": "b0794e2a65d5356a8fdb262f0acf26753ac1aebfedf9b1e252d4dce4a21bc9a1",
"catalogDigest": "5a170c4fb33ea5bb4fe1d839ff0d405db53b82e586aead0891babafbb59b40aa",
"commandCount": 651,
"coverage": {
"commandCount": 651,
Expand Down
2 changes: 1 addition & 1 deletion docs/sdlc-harness/features/agent-evaluation.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@

范围:

- 评测 PlanDebug、Review、严格审查、Agentic、Mini App、remote、MCP 等模式
- 评测 Plan/Debug Skill、Review、严格审查、Agentic、Mini App、remote、MCP 等工作流与能力
- 评测工具接口、上下文策略、hook 策略、审批/安全策略。
- 评测配置化策略是否误升级、漏提示或过度打断。
- 评测安全边界是否降低风险且不制造无意义确认。
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ BitFun 后续不应把 dynamic workflow 理解成一个需要用户学习的新

### 4.1 从固定模式改为自适应执行

现有体验容易把 Agentic、Plan、Debug、Review、DeepReview 等理解为不同模式。后续应调整为
现有体验曾经容易把 Agentic、Plan、Debug、Review、DeepReview 等理解为不同模式;Plan 和 Debug 现已收敛为 Skill,后续仍应继续按以下方向调整

```text
用户表达目标
Expand Down
19 changes: 0 additions & 19 deletions scripts/core-boundaries/rules/source/required-rules.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7897,21 +7897,6 @@ export const requiredContentRules = [
},
],
},
{
path: 'src/crates/assembly/core/src/agentic/agents/definitions/modes/mod.rs',
reason:
'core agent mode definitions must continue exposing Multitask mode until an approved agent-runtime migration preserves mode registration semantics',
patterns: [
{
regex: /\bmod multitask\b/,
message: 'missing Multitask mode module',
},
{
regex: /\bpub use multitask::MultitaskMode\b/,
message: 'missing Multitask mode export',
},
],
},
{
path: 'src/crates/assembly/core/src/agentic/agents/definitions/subagents/mod.rs',
reason:
Expand Down Expand Up @@ -7951,10 +7936,6 @@ export const requiredContentRules = [
regex: /\bbuiltin_agent_definition_specs\(\)/,
message: 'missing builtin agent definition catalog owner',
},
{
regex: /builtin_agent_spec\(\s*"Multitask",\s*Mode,\s*"auto"/,
message: 'missing Multitask runtime default model mapping',
},
{
regex: /builtin_agent_spec\(\s*"GeneralPurpose",\s*SubAgent,\s*"primary"/,
message: 'missing GeneralPurpose runtime default model mapping',
Expand Down
4 changes: 0 additions & 4 deletions scripts/core-boundaries/self-test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4204,10 +4204,6 @@ export function runManifestParserSelfTest({
path: 'src/crates/assembly/core/src/agentic/agents/registry/types.rs',
contracts: ['SubagentQueryContext', 'SubagentListScope', 'default_enabled', 'effective_enabled', 'SubagentStateReason'],
},
{
path: 'src/crates/assembly/core/src/agentic/agents/definitions/modes/mod.rs',
contracts: ['mod multitask', 'MultitaskMode'],
},
{
path: 'src/crates/assembly/core/src/agentic/agents/definitions/subagents/mod.rs',
contracts: ['mod general_purpose', 'GeneralPurposeAgent'],
Expand Down
10 changes: 8 additions & 2 deletions scripts/core-boundaries/source-content-checks.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { spawnSync } from 'node:child_process';
import { readFileSync } from 'node:fs';
import { existsSync, readFileSync } from 'node:fs';
import { join } from 'node:path';

export function listTrackedRustRepoPaths(root) {
Expand All @@ -11,7 +11,13 @@ export function listTrackedRustRepoPaths(root) {
if (result.status !== 0) {
throw new Error(result.stderr.trim() || 'git ls-files failed');
}
return result.stdout.split('\0').filter(Boolean);
return result.stdout
.split('\0')
.filter(Boolean)
// `git ls-files` continues to report tracked files deleted only in the
// working tree. Boundary scans must evaluate the prospective checkout
// without requiring callers to stage deletions first.
.filter((repoPath) => existsSync(join(root, ...repoPath.split('/'))));
}

function stripRustComments(text) {
Expand Down
4 changes: 2 additions & 2 deletions scripts/i18n-contract.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -271,11 +271,11 @@ test('web-ui slash command picker distinguishes all commands from quick actions'
const source = readText('src/web-ui/src/flow_chat/components/ChatInput.tsx');
const allCommandsStart = source.indexOf("if (slashCommandState.kind === 'all')");
const allCommandsEnd = source.indexOf(
'if (!canSwitchModes || !showStandardExecutionOptions)',
"if (slashCommandState.kind === 'skills')",
allCommandsStart,
);
assert.notEqual(allCommandsStart, -1, 'ChatInput should render an all-command slash picker state');
assert.notEqual(allCommandsEnd, -1, 'ChatInput all-command branch should stay before the mode-only branch');
assert.notEqual(allCommandsEnd, -1, 'ChatInput all-command branch should stay before the skills-only branch');

const allCommandsBlock = source.slice(allCommandsStart, allCommandsEnd);
assert.match(
Expand Down
4 changes: 2 additions & 2 deletions src/apps/cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2199,8 +2199,8 @@ mod harness_profile_compatibility_tests {
"minimal"
);
assert_eq!(
agent_type_with_harness_profile("Plan".to_string(), Some("balanced")),
"Plan"
agent_type_with_harness_profile("Cowork".to_string(), Some("balanced")),
"Cowork"
);
}

Expand Down
2 changes: 1 addition & 1 deletion src/apps/cli/src/modes/chat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ const LINEAGE_SETTLEMENT_RETRY_MAX: Duration = Duration::from_secs(1);
pub(crate) struct ChatMode {
config: CliConfig,
keymap: ResolvedKeymap,
/// Current agent type (e.g. "agentic", "Plan", "Multitask")
/// Current agent type (e.g. "agentic", "Cowork", "DeepResearch")
agent_type: String,
workspace: Option<String>,
local_cwd: std::path::PathBuf,
Expand Down
2 changes: 1 addition & 1 deletion src/apps/cli/src/modes/chat/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1818,7 +1818,7 @@ mod tests {
fn previous_session_update_failure_is_not_reported_as_a_success() {
let status = previous_session_update_status(
"mode",
"Plan",
"Cowork",
&SessionUpdateApplyOutcome::SessionUpdateFailed("storage unavailable".to_string()),
);

Expand Down
8 changes: 4 additions & 4 deletions src/apps/cli/tests/acp_stdio_cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -215,14 +215,14 @@ async fn acp_stdio_preserves_mode_and_history_across_restart_then_closes_active_
json!({
"sessionId": session_id,
"configId": "mode",
"value": " Plan "
"value": " Cowork "
}),
)
.await;
assert!(configured.get("error").is_none(), "{configured}");
assert_eq!(
current_config_value(&configured, "mode"),
Some(&json!("Plan"))
Some(&json!("Cowork"))
);
assert!(
mode_updates.iter().all(|message| {
Expand Down Expand Up @@ -335,7 +335,7 @@ async fn acp_stdio_preserves_mode_and_history_across_restart_then_closes_active_
.find(|response| response.get("error").is_some())
.expect("one concurrent session/load must be rejected");
assert!(loaded.get("error").is_none(), "{loaded}");
assert_eq!(current_config_value(loaded, "mode"), Some(&json!("Plan")));
assert_eq!(current_config_value(loaded, "mode"), Some(&json!("Cowork")));
assert!(
!replay_updates.is_empty(),
"session/load must replay persisted history before its success response"
Expand Down Expand Up @@ -383,7 +383,7 @@ async fn acp_stdio_preserves_mode_and_history_across_restart_then_closes_active_
);
assert_eq!(
current_config_value(&reloaded_after_close, "mode"),
Some(&json!("Plan"))
Some(&json!("Cowork"))
);
assert_eq!(
replay_after_close
Expand Down
Loading
Loading