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
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ impl DeepResearchMode {
"Read".to_string(),
"Grep".to_string(),
"Glob".to_string(),
"LS".to_string(),
"Write".to_string(),
"Edit".to_string(),
"ExecCommand".to_string(),
Expand Down
4 changes: 2 additions & 2 deletions src/crates/assembly/core/src/agentic/agents/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ pub use definitions::subagents::{
use indexmap::IndexMap;
pub use prompt_builder::{
build_prompt_context_for_workspace, PrependedPromptReminders, PromptBuilder,
PromptBuilderContext, RemoteExecutionHints, ToolListingSections, UserContextPolicy,
UserContextSection,
PromptBuilderContext, RemoteExecutionHints, RuntimeContextNeeds, ToolListingSections,
UserContextPolicy, UserContextSection,
};
pub use registry::catalog::{builtin_agent_specs, BuiltinAgentSpec};
pub use registry::types::{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ mod user_context;
pub use bitfun_agent_runtime::prompt::{PrependedPromptReminders, ToolListingSections};
pub use prompt_builder_impl::{
build_prompt_context_for_workspace, PromptBuilder, PromptBuilderContext, RemoteExecutionHints,
RuntimeContextNeeds,
};
pub use user_context::{UserContextPolicy, UserContextSection};

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -112,4 +112,3 @@ IMPORTANT: Whenever you mention a file path that the user might want to open, ma
</bad-examples>

{LANGUAGE_PREFERENCE}
{ENV_INFO}
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,5 @@ Do not manipulate or persuade anyone to expand access or disable safeguards. Do
Keep narration brief and value-dense. For multi-step work, state the near-term plan and then keep progress updates short.

{CLAW_WORKSPACE}
{ENV_INFO}
{PERSONA}
{AGENT_MEMORY}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Prefer script or command-line automation when it is clearly safer and reversible

# OS-Specific Control Profile

Use the local OS reported in the environment information.
Use the local OS reported in Runtime Context.

For macOS:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,13 @@ Cowork mode includes WebFetch and WebSearch tools for retrieving web content. Th

BitFun runs tools in a secure sandboxed runtime with controlled access to user files.
The exact host environment can vary by platform/deployment, so BitFun should rely on
Environment Information for OS/runtime details and should not assume a specific VM or OS.
Runtime Context for OS/runtime details and should not assume a specific VM or OS.
Available tools:
* ExecCommand - Execute commands
* Edit - Edit existing files
* Write - Create new files
* Read - Read files and directories
Working directory: use the current working directory shown in Environment Information.
Working directory: use the current working directory shown in Runtime Context.
The runtime's internal file system can reset between tasks, but the selected workspace folder
persists on the user's actual computer. Files saved to the workspace folder remain accessible to the user after the session ends.
When BitFun creates files like docx, pptx, xlsx, save them in the workspace and share a direct markdown link when available.
Expand Down Expand Up @@ -162,5 +162,3 @@ Example decisions:
# Additional Skills Reminder

For computer-use tasks, proactively use relevant skills when a domain-specific workflow is involved and the skill is available. Load skills by name, and combine them only when that adds clear value.

{ENV_INFO}
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
You are a senior research analyst and orchestrator. Your job is to produce a deep-research report that reads like investigative journalism — specific, sourced, opinionated, and grounded in evidence. You run a structured 6-phase quality pipeline where specialists, debaters, and a fact-checker each play a distinct role, and you assemble their outputs into a final report.

{ENV_INFO}

**Subject of Research** = the topic provided by the user in their message.

**Current date**: provided in the environment info above. Use it only for the output file name and for explicit date stamping. Do **not** inject the current year into search queries — let search results establish the actual timeline.
**Current date**: Use current date for the output file name and for explicit date stamping. Do **not** inject the current year into search queries — let search results establish the actual timeline.

---

Expand Down Expand Up @@ -78,7 +76,7 @@ Build these constants for the whole pipeline:

```
SESSION_ID = {SESSION_ID}
TODAY = current calendar date in YYYY-MM-DD when available from runtime/request context; ask before making date-sensitive claims if it is not available
TODAY = current calendar date in YYYY-MM-DD
WORK_DIR = <workspace_root>/.bitfun/sessions/{SESSION_ID}/research
REPORT_PATH = <WORK_DIR>/report.md
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,3 @@ You are a general-purpose agent for BitFun, a desktop AI IDE and agent runtime.
- Include the relevant file paths you changed or inspected when they matter to the parent agent.
- Include short code snippets only when the exact text is load-bearing.
- Avoid emojis.

{ENV_INFO}
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,3 @@ Before finalizing documentation:
- **NEVER ask questions to the user** - use tools to gather all needed information
- All paths in the output must be accurate relative to project root
- NEVER use emojis

{ENV_INFO}

Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
You are a read-only **web research specialist** dispatched by a parent research agent. The parent gives you one focused role (e.g. *Primary Source Specialist*, *News & Timeline Specialist*, *Expert Opinion Specialist*, *Counter-evidence Specialist*, or *Competitor Profile*) and a brief. Your job is to gather evidence from the web and return a structured markdown report.

{ENV_INFO}

## Your tools

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -317,5 +317,3 @@ Mark phases complete only after their mandatory skill has run and its output has
- Be careful not to introduce security vulnerabilities.
- When invoking a skill, trust its methodology and follow its instructions fully.
- If a skill's output contradicts the current plan, surface the conflict to the user before proceeding.

{ENV_INFO}
37 changes: 30 additions & 7 deletions src/crates/assembly/core/src/agentic/execution/execution_engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use super::round_executor::RoundExecutor;
use super::types::{ExecutionContext, ExecutionResult, RoundContext, RoundResult};
use crate::agentic::agents::{
build_prompt_context_for_workspace, get_agent_registry, PrependedPromptReminders,
PromptBuilder, PromptBuilderContext, ToolListingSections,
PromptBuilder, PromptBuilderContext, RuntimeContextNeeds, ToolListingSections,
};
use crate::agentic::context_profile::{ContextProfilePolicy, ModelCapabilityProfile};
use crate::agentic::core::{
Expand Down Expand Up @@ -577,6 +577,7 @@ impl ExecutionEngine {
model_name: &str,
supports_image_understanding: bool,
tool_listing_sections: ToolListingSections,
runtime_context_needs: RuntimeContextNeeds,
) -> Option<PromptBuilderContext> {
let workspace = context.workspace.as_ref()?;
let remote_file_delivery_channel = context
Expand All @@ -592,6 +593,7 @@ impl ExecutionEngine {
Some(model_name.to_string()),
Some(supports_image_understanding),
tool_listing_sections,
runtime_context_needs,
)
.await
.map(|prompt_context| {
Expand Down Expand Up @@ -660,15 +662,17 @@ impl ExecutionEngine {
}
built_user_context
};
let runtime_context = prompt_builder.build_runtime_context_reminder().await;

PrependedPromptReminders {
collapsed_tool_listing: prompt_builder.build_collapsed_tool_listing_reminder(),
skill_listing: baseline_tool_sections
.as_ref()
.and_then(|sections| sections.render_skill_listing_reminder()),
agent_listing: baseline_tool_sections
.as_ref()
.and_then(|sections| sections.render_agent_listing_reminder()),
collapsed_tool_listing: prompt_builder.build_collapsed_tool_listing_reminder(),
runtime_context,
user_context,
}
}
Expand Down Expand Up @@ -907,7 +911,7 @@ impl ExecutionEngine {
.iter()
.position(|msg| msg.role != crate::agentic::core::MessageRole::System)
.unwrap_or(messages.len());
let mut user_context_injected = false;
let mut prepended_reminders_injected = false;

let keep_image_messages = if attach_images {
Self::image_bearing_indices_to_keep(messages, MAX_IMAGE_BEARING_MESSAGE_ROUNDS)
Expand All @@ -916,11 +920,11 @@ impl ExecutionEngine {
};

for (msg_idx, msg) in messages.iter().enumerate() {
if !user_context_injected && msg_idx == first_non_system_index {
if !prepended_reminders_injected && msg_idx == first_non_system_index {
for reminder in &trimmed_reminders {
result.push(AIMessage::user(render_system_reminder(reminder)));
}
user_context_injected = true;
prepended_reminders_injected = true;
}

if Self::skip_message_for_model_send(msg) {
Expand Down Expand Up @@ -1043,7 +1047,7 @@ impl ExecutionEngine {
}
}

if !user_context_injected {
if !prepended_reminders_injected {
for reminder in trimmed_reminders {
result.push(AIMessage::user(render_system_reminder(reminder)));
}
Expand Down Expand Up @@ -1360,13 +1364,20 @@ impl ExecutionEngine {
} else {
ToolListingSections::default()
};
let runtime_context_needs = tool_manifest
.as_ref()
.map(|manifest| {
RuntimeContextNeeds::from_tool_names(manifest.allowed_tool_names.iter())
})
.unwrap_or_default();
let tool_definitions = tool_manifest.map(|manifest| manifest.tool_definitions);

let prompt_context = Self::build_prompt_context(
context,
&ai_client.config.model,
primary_supports_image_understanding,
tool_listing_sections,
runtime_context_needs,
)
.await;
let prepended_prompt_reminders = self
Expand Down Expand Up @@ -2040,6 +2051,12 @@ impl ExecutionEngine {
} else {
ToolListingSections::default()
};
let runtime_context_needs = tool_manifest
.as_ref()
.map(|manifest| {
RuntimeContextNeeds::from_tool_names(manifest.allowed_tool_names.iter())
})
.unwrap_or_default();
let (available_tools, tool_definitions) = if let Some(manifest) = tool_manifest {
(manifest.allowed_tool_names, Some(manifest.tool_definitions))
} else {
Expand All @@ -2057,6 +2074,7 @@ impl ExecutionEngine {
&ai_client.config.model,
primary_supports_image_understanding,
tool_listing_sections,
runtime_context_needs,
)
.await;
let prepended_prompt_reminders = self
Expand All @@ -2077,7 +2095,7 @@ impl ExecutionEngine {
.await?;
debug!("System prompt built, length: {} bytes", system_prompt.len());
debug!(
"Prepended reminders built: skill_listing_len={} agent_listing_len={} collapsed_tool_listing_len={} user_context_len={}",
"Prepended reminders built: skill_listing_len={} agent_listing_len={} collapsed_tool_listing_len={} user_context_len={} runtime_context_len={}",
prepended_prompt_reminders
.skill_listing
.as_ref()
Expand All @@ -2097,6 +2115,11 @@ impl ExecutionEngine {
.user_context
.as_ref()
.map(|text| text.len())
.unwrap_or(0),
prepended_prompt_reminders
.runtime_context
.as_ref()
.map(|text| text.len())
.unwrap_or(0)
);
let system_prompt_message = Message::system(system_prompt.clone());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,7 @@ pub async fn build_embedded_user_context_reminder(
None,
None,
ToolListingSections::default(),
Default::default(),
)
.await?;
PromptBuilder::new(context)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ Notes:
| `ExecCommand` | Expanded | None | - |
| `WriteStdin` | Expanded | None | - |
| `ExecControl` | Expanded | None | - |
| `GetTime` | Expanded | None | - |
| `Task` | Expanded | None | - |
| `Skill` | Expanded | None | - |
| `AskUserQuestion` | Expanded | None | - |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ The **primary model cannot consume images** in tool results — **do not** use *
"macos" => "On this host use command/option/control/shift in key_chord (not Win/Linux names). **System clipboard (prefer over type_text when pasting):** command+a select all, command+c copy, command+x cut, command+v paste — combine with focus/selection shortcuts as needed.",
"windows" => "On this host use meta (Windows key), alt, control, shift in key_chord. **System clipboard:** control+a/c/x/v for select all, copy, cut, paste.",
"linux" => "On this host use control, alt, shift, and meta/super as appropriate for the desktop. **System clipboard:** typically control+a/c/x/v (match the app and DE).",
_ => "Match key_chord modifiers to the host OS in the system prompt Environment Information. Prefer standard clipboard chords (select all, copy, cut, paste) before long type_text.",
_ => "Match key_chord modifiers to the host OS in Runtime Context. Prefer standard clipboard chords (select all, copy, cut, paste) before long type_text.",
}
}

Expand Down
Loading
Loading