refactor: remove planning mode from the CLI (#12061)
This commit is contained in:
@@ -24,8 +24,6 @@ pub enum InputResult {
|
||||
PromptCommand(PromptCommandOptions),
|
||||
GooseMode(String),
|
||||
Model(ModelCommandOptions),
|
||||
Plan(PlanCommandOptions),
|
||||
EndPlan,
|
||||
Clear,
|
||||
New,
|
||||
Compact,
|
||||
@@ -42,11 +40,6 @@ pub struct PromptCommandOptions {
|
||||
pub arguments: HashMap<String, String>,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct PlanCommandOptions {
|
||||
pub message_text: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Default)]
|
||||
pub struct ModelCommandOptions {
|
||||
pub provider: Option<String>,
|
||||
@@ -236,8 +229,6 @@ fn handle_slash_command(input: &str) -> Option<InputResult> {
|
||||
const CMD_MODE: &str = "/mode ";
|
||||
const CMD_MODEL: &str = "/model";
|
||||
const CMD_MODEL_WITH_SPACE: &str = "/model ";
|
||||
const CMD_PLAN: &str = "/plan";
|
||||
const CMD_ENDPLAN: &str = "/endplan";
|
||||
const CMD_CLEAR: &str = "/clear";
|
||||
const CMD_NEW: &str = "/new";
|
||||
const CMD_COMPACT: &str = "/compact";
|
||||
@@ -330,10 +321,6 @@ fn handle_slash_command(input: &str) -> Option<InputResult> {
|
||||
}))
|
||||
}
|
||||
}
|
||||
s if s.starts_with(CMD_PLAN) => {
|
||||
parse_plan_command(s.get(CMD_PLAN.len()..).unwrap_or("").trim().to_string())
|
||||
}
|
||||
s if s == CMD_ENDPLAN => Some(InputResult::EndPlan),
|
||||
s if s == CMD_CLEAR => Some(InputResult::Clear),
|
||||
s if s == CMD_NEW => Some(InputResult::New),
|
||||
s if s == CMD_COMPACT => Some(InputResult::Compact),
|
||||
@@ -421,14 +408,6 @@ fn parse_prompt_command(args: &str) -> Option<InputResult> {
|
||||
Some(InputResult::PromptCommand(options))
|
||||
}
|
||||
|
||||
fn parse_plan_command(input: String) -> Option<InputResult> {
|
||||
let options = PlanCommandOptions {
|
||||
message_text: input.trim().to_string(),
|
||||
};
|
||||
|
||||
Some(InputResult::Plan(options))
|
||||
}
|
||||
|
||||
fn help_text() -> String {
|
||||
let modes = GooseMode::VARIANTS.join(", ");
|
||||
let newline_key = get_newline_key().to_ascii_uppercase();
|
||||
@@ -452,12 +431,6 @@ fn help_text() -> String {
|
||||
/mode <name> - Set the goose mode to use ({modes})
|
||||
/model [name] - Show the current model, or switch models for this session while keeping the same provider
|
||||
/model --provider <name> [model] - Switch to a different provider (optionally specifying a model)
|
||||
/plan <message_text> - Enters 'plan' mode with optional message. Create a plan based on the current messages and asks user if they want to act on it.
|
||||
If user acts on the plan, goose mode is set to 'auto' and returns to 'normal' goose mode.
|
||||
To warm up goose before using '/plan', we recommend setting '/mode approve' & putting appropriate context into goose.
|
||||
The model is used based on $GOOSE_PLANNER_PROVIDER and $GOOSE_PLANNER_MODEL environment variables.
|
||||
If no model is set, the default model is used.
|
||||
/endplan - Exit plan mode and return to 'normal' goose mode.
|
||||
/compact - Compact the current conversation to reduce context length while preserving key information.
|
||||
{additional_builtin_help}/status - Show session status: model, provider, mode, and token usage.
|
||||
/edit [text] - Open your prompt editor to compose a message. Optionally pre-fill with text.
|
||||
@@ -797,24 +770,6 @@ mod tests {
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_plan_mode() {
|
||||
// Test plan mode with no text
|
||||
let result = handle_slash_command("/plan");
|
||||
assert!(result.is_some());
|
||||
|
||||
// Test plan mode with text
|
||||
let result = handle_slash_command("/plan hello world");
|
||||
assert!(result.is_some());
|
||||
let options = result.unwrap();
|
||||
match options {
|
||||
InputResult::Plan(options) => {
|
||||
assert_eq!(options.message_text, "hello world");
|
||||
}
|
||||
_ => panic!("Expected Plan"),
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn recipe_command_is_not_builtin() {
|
||||
assert!(handle_slash_command("/recipe").is_none());
|
||||
|
||||
@@ -12,7 +12,7 @@ mod thinking;
|
||||
use crate::session::task_execution_display::{
|
||||
format_task_execution_notification, TASK_EXECUTION_NOTIFICATION_TYPE,
|
||||
};
|
||||
use goose::conversation::{fix_conversation, merge_consecutive_messages_for_request, Conversation};
|
||||
use goose::conversation::Conversation;
|
||||
use std::io::Write;
|
||||
use std::str::FromStr;
|
||||
use tokio::signal::ctrl_c;
|
||||
@@ -27,7 +27,6 @@ use goose::agents::platform_extensions::developer::shell::{
|
||||
use goose::agents::AgentEvent;
|
||||
use goose::agents::SUBAGENT_TOOL_REQUEST_TYPE;
|
||||
use goose::permission::Permission;
|
||||
use goose::providers::base::Provider;
|
||||
use goose::providers::base::ProviderUsage;
|
||||
use goose::utils::safe_truncate;
|
||||
|
||||
@@ -122,19 +121,6 @@ pub(crate) fn derive_extension_name_from_command(cmd: &str, args: &[String]) ->
|
||||
}
|
||||
}
|
||||
|
||||
fn planner_provider_messages(plan_messages: &Conversation) -> Conversation {
|
||||
// The planner prompt has no turn-context instructions; drop the blocks.
|
||||
let projected_messages: Vec<Message> = plan_messages
|
||||
.agent_visible_messages()
|
||||
.into_iter()
|
||||
.filter(|message| !message.is_turn_context())
|
||||
.collect();
|
||||
let fixed = fix_conversation(Conversation::new_unvalidated(projected_messages)).0;
|
||||
Conversation::new_unvalidated(merge_consecutive_messages_for_request(
|
||||
fixed.messages().clone(),
|
||||
))
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
struct JsonOutput {
|
||||
messages: Vec<Message>,
|
||||
@@ -199,11 +185,6 @@ enum NotificationData {
|
||||
},
|
||||
}
|
||||
|
||||
pub enum RunMode {
|
||||
Normal,
|
||||
Plan,
|
||||
}
|
||||
|
||||
struct HistoryManager {
|
||||
history_file: PathBuf,
|
||||
old_history_file: PathBuf,
|
||||
@@ -257,7 +238,6 @@ pub struct CliSession {
|
||||
session_id: String,
|
||||
completion_cache: Arc<std::sync::RwLock<CompletionCache>>,
|
||||
debug: bool,
|
||||
run_mode: RunMode,
|
||||
scheduled_job_id: Option<String>,
|
||||
max_turns: Option<u32>,
|
||||
edit_mode: Option<EditMode>,
|
||||
@@ -303,55 +283,6 @@ impl CompletionCache {
|
||||
}
|
||||
}
|
||||
|
||||
pub enum PlannerResponseType {
|
||||
Plan,
|
||||
ClarifyingQuestions,
|
||||
}
|
||||
|
||||
/// Decide if the planner's response is a plan or a clarifying question
|
||||
///
|
||||
/// This function is called after the planner has generated a response
|
||||
/// to the user's message. The response is either a plan or a clarifying
|
||||
/// question.
|
||||
pub async fn classify_planner_response(
|
||||
session_id: &str,
|
||||
message_text: String,
|
||||
provider: Arc<dyn Provider>,
|
||||
model_config: goose_providers::model::ModelConfig,
|
||||
) -> Result<PlannerResponseType> {
|
||||
let prompt = format!(
|
||||
"The text below is the output from an AI model which can either provide a plan or list of clarifying questions. Based on the text below, decide if the output is a \"plan\" or \"clarifying questions\".\n---\n{message_text}"
|
||||
);
|
||||
|
||||
let message = Message::user().with_text(&prompt);
|
||||
let (result, _usage) = goose::session_context::with_session_id(
|
||||
Some(session_id.to_string()),
|
||||
provider.complete(
|
||||
&model_config,
|
||||
"Reply only with the classification label: \"plan\" or \"clarifying questions\"",
|
||||
&[message],
|
||||
&[],
|
||||
),
|
||||
)
|
||||
.await?;
|
||||
|
||||
let predicted = result.as_concat_text();
|
||||
if predicted.to_lowercase().contains("plan") {
|
||||
Ok(PlannerResponseType::Plan)
|
||||
} else {
|
||||
Ok(PlannerResponseType::ClarifyingQuestions)
|
||||
}
|
||||
}
|
||||
|
||||
fn planner_classification_text(response: &Message) -> Result<String> {
|
||||
let text = response.agent_visible_content().as_concat_text();
|
||||
anyhow::ensure!(
|
||||
!text.trim().is_empty(),
|
||||
"Planner returned no agent-visible text to classify"
|
||||
);
|
||||
Ok(text)
|
||||
}
|
||||
|
||||
impl CliSession {
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub async fn new(
|
||||
@@ -396,7 +327,6 @@ impl CliSession {
|
||||
session_id,
|
||||
completion_cache,
|
||||
debug,
|
||||
run_mode: RunMode::Normal,
|
||||
scheduled_job_id,
|
||||
max_turns,
|
||||
edit_mode,
|
||||
@@ -788,13 +718,6 @@ impl CliSession {
|
||||
history.save(editor);
|
||||
self.handle_model(options).await?;
|
||||
}
|
||||
InputResult::Plan(options) => {
|
||||
self.handle_plan_mode(options).await?;
|
||||
}
|
||||
InputResult::EndPlan => {
|
||||
self.run_mode = RunMode::Normal;
|
||||
output::render_exit_plan_mode();
|
||||
}
|
||||
InputResult::Clear => {
|
||||
history.save(editor);
|
||||
self.handle_clear().await?;
|
||||
@@ -860,33 +783,22 @@ impl CliSession {
|
||||
history: &HistoryManager,
|
||||
editor: &mut rustyline::Editor<GooseCompleter, rustyline::history::DefaultHistory>,
|
||||
) -> Result<()> {
|
||||
match self.run_mode {
|
||||
RunMode::Normal => {
|
||||
history.save(editor);
|
||||
self.push_message(Message::user().with_text(content));
|
||||
history.save(editor);
|
||||
self.push_message(Message::user().with_text(content));
|
||||
|
||||
let _provider = self.agent.provider().await?;
|
||||
let _provider = self.agent.provider().await?;
|
||||
|
||||
println!();
|
||||
output::run_status_hook("thinking");
|
||||
output::show_thinking();
|
||||
let start_time = Instant::now();
|
||||
self.process_agent_response(true, CancellationToken::default())
|
||||
.await?;
|
||||
output::hide_thinking();
|
||||
println!();
|
||||
output::run_status_hook("thinking");
|
||||
output::show_thinking();
|
||||
let start_time = Instant::now();
|
||||
self.process_agent_response(true, CancellationToken::default())
|
||||
.await?;
|
||||
output::hide_thinking();
|
||||
|
||||
let elapsed = start_time.elapsed();
|
||||
let elapsed_str = format_elapsed_time(elapsed);
|
||||
println!("{}", console::style(format!(" ⏱ {}", elapsed_str)).dim());
|
||||
}
|
||||
RunMode::Plan => {
|
||||
let mut plan_messages = self.messages.clone();
|
||||
plan_messages.push(Message::user().with_text(content));
|
||||
let (reasoner, reasoner_model_config) = get_reasoner().await?;
|
||||
self.plan_with_reasoner_model(plan_messages, reasoner, reasoner_model_config)
|
||||
.await?;
|
||||
}
|
||||
}
|
||||
let elapsed = start_time.elapsed();
|
||||
let elapsed_str = format_elapsed_time(elapsed);
|
||||
println!("{}", console::style(format!(" ⏱ {}", elapsed_str)).dim());
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -1141,22 +1053,6 @@ impl CliSession {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn handle_plan_mode(&mut self, options: input::PlanCommandOptions) -> Result<()> {
|
||||
self.run_mode = RunMode::Plan;
|
||||
output::render_enter_plan_mode();
|
||||
|
||||
if options.message_text.is_empty() {
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
let mut plan_messages = self.messages.clone();
|
||||
plan_messages.push(Message::user().with_text(&options.message_text));
|
||||
|
||||
let (reasoner, reasoner_model_config) = get_reasoner().await?;
|
||||
self.plan_with_reasoner_model(plan_messages, reasoner, reasoner_model_config)
|
||||
.await
|
||||
}
|
||||
|
||||
async fn handle_clear(&mut self) -> Result<()> {
|
||||
let provider = self.agent.provider().await?;
|
||||
if provider.manages_own_context() {
|
||||
@@ -1237,7 +1133,6 @@ impl CliSession {
|
||||
|
||||
self.session_id = new_session_id;
|
||||
self.messages.clear();
|
||||
self.run_mode = RunMode::Normal;
|
||||
self.agent.set_goal(None).await;
|
||||
self.agent.set_grind(None).await;
|
||||
|
||||
@@ -1390,105 +1285,6 @@ impl CliSession {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn plan_with_reasoner_model(
|
||||
&mut self,
|
||||
plan_messages: Conversation,
|
||||
reasoner: Arc<dyn Provider>,
|
||||
model_config: goose_providers::model::ModelConfig,
|
||||
) -> Result<(), anyhow::Error> {
|
||||
let plan_prompt = self.agent.get_plan_prompt(&self.session_id).await?;
|
||||
let provider_messages = planner_provider_messages(&plan_messages);
|
||||
output::show_thinking();
|
||||
let (plan_response, _usage) = goose::session_context::with_session_id(
|
||||
Some(self.session_id.clone()),
|
||||
reasoner.complete(
|
||||
&model_config,
|
||||
&plan_prompt,
|
||||
provider_messages.messages(),
|
||||
&[],
|
||||
),
|
||||
)
|
||||
.await?;
|
||||
let classifier_text = planner_classification_text(&plan_response);
|
||||
let plan_response = plan_response.user_visible_content();
|
||||
output::render_message(&plan_response, self.debug);
|
||||
output::hide_thinking();
|
||||
let classifier_text = classifier_text?;
|
||||
anyhow::ensure!(
|
||||
!plan_response.content.is_empty(),
|
||||
"Planner returned no user-visible content"
|
||||
);
|
||||
let planner_response_type = classify_planner_response(
|
||||
&self.session_id,
|
||||
classifier_text,
|
||||
self.agent.provider().await?,
|
||||
self.agent
|
||||
.model_config_for_session(&self.session_id)
|
||||
.await?,
|
||||
)
|
||||
.await?;
|
||||
|
||||
output::emit_attention_bell();
|
||||
|
||||
match planner_response_type {
|
||||
PlannerResponseType::Plan => {
|
||||
println!();
|
||||
let should_act = match cliclack::confirm(
|
||||
"Do you want to clear message history & act on this plan?",
|
||||
)
|
||||
.initial_value(true)
|
||||
.interact()
|
||||
{
|
||||
Ok(choice) => choice,
|
||||
Err(e) => {
|
||||
if e.kind() == std::io::ErrorKind::Interrupted {
|
||||
false // If interrupted, set should_act to false
|
||||
} else {
|
||||
return Err(e.into());
|
||||
}
|
||||
}
|
||||
};
|
||||
if should_act {
|
||||
output::render_act_on_plan();
|
||||
self.run_mode = RunMode::Normal;
|
||||
// set goose mode: auto if that isn't already the case
|
||||
let config = Config::global();
|
||||
let curr_goose_mode = config.get_goose_mode().unwrap_or_default();
|
||||
if curr_goose_mode != GooseMode::Auto {
|
||||
config.set_goose_mode(GooseMode::Auto).unwrap();
|
||||
}
|
||||
|
||||
// clear the messages before acting on the plan
|
||||
self.messages.clear();
|
||||
// add the plan response as a user message
|
||||
let plan_message = Message::user().with_text(plan_response.as_concat_text());
|
||||
self.push_message(plan_message);
|
||||
// act on the plan
|
||||
output::show_thinking();
|
||||
self.process_agent_response(true, CancellationToken::default())
|
||||
.await?;
|
||||
output::hide_thinking();
|
||||
|
||||
// Reset run & goose mode
|
||||
if curr_goose_mode != GooseMode::Auto {
|
||||
config.set_goose_mode(curr_goose_mode)?;
|
||||
}
|
||||
} else {
|
||||
// add the plan response (assistant message) & carry the conversation forward
|
||||
// in the next round, the user might wanna slightly modify the plan
|
||||
self.push_message(plan_response);
|
||||
}
|
||||
}
|
||||
PlannerResponseType::ClarifyingQuestions => {
|
||||
// add the plan response (assistant message) & carry the conversation forward
|
||||
// in the next round, the user will answer the clarifying questions
|
||||
self.push_message(plan_response);
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Process a single message and exit
|
||||
pub async fn headless(&mut self, prompt: String) -> Result<()> {
|
||||
let message = Message::user().with_text(&prompt);
|
||||
@@ -2831,40 +2627,6 @@ fn headless_run_error(
|
||||
})
|
||||
}
|
||||
|
||||
async fn get_reasoner(
|
||||
) -> Result<(Arc<dyn Provider>, goose_providers::model::ModelConfig), anyhow::Error> {
|
||||
use goose::providers::create;
|
||||
|
||||
let config = Config::global();
|
||||
|
||||
// Try planner-specific provider first, fall back to default provider
|
||||
let provider = if let Ok(provider) = config.get_param::<String>("GOOSE_PLANNER_PROVIDER") {
|
||||
provider
|
||||
} else {
|
||||
println!("WARNING: GOOSE_PLANNER_PROVIDER not found. Using default provider...");
|
||||
config
|
||||
.get_goose_provider()
|
||||
.expect("No provider configured. Run 'goose configure' first")
|
||||
};
|
||||
|
||||
// Try planner-specific model first, fall back to default model
|
||||
let model = if let Ok(model) = config.get_param::<String>("GOOSE_PLANNER_MODEL") {
|
||||
model
|
||||
} else {
|
||||
println!("WARNING: GOOSE_PLANNER_MODEL not found. Using default model...");
|
||||
config
|
||||
.get_goose_model()
|
||||
.expect("No model configured. Run 'goose configure' first")
|
||||
};
|
||||
|
||||
let model_config =
|
||||
goose::model_config::model_config_from_user_config(&provider, model.as_str())?;
|
||||
let extensions = goose::config::extensions::get_enabled_extensions_with_config(config);
|
||||
let reasoner = create(&provider, extensions).await?;
|
||||
|
||||
Ok((reasoner, model_config))
|
||||
}
|
||||
|
||||
/// Format elapsed time duration
|
||||
/// Shows seconds if less than 60, otherwise shows minutes:seconds
|
||||
fn format_elapsed_time(duration: std::time::Duration) -> String {
|
||||
@@ -2899,6 +2661,7 @@ mod tests {
|
||||
use goose::agents::extension::Envs;
|
||||
use goose::config::ExtensionConfig;
|
||||
use goose::conversation::message::MessageErrorKind;
|
||||
use goose::providers::base::Provider;
|
||||
use serde_json::json;
|
||||
use std::collections::HashMap;
|
||||
use std::time::Duration;
|
||||
@@ -2963,81 +2726,6 @@ mod tests {
|
||||
assert_eq!(request.prompt.as_deref(), Some("Review this request"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn planner_classification_excludes_user_only_content() {
|
||||
use rmcp::model::{Annotations, Role, TextContent};
|
||||
|
||||
let user_only = TextContent::new("user-only plan")
|
||||
.with_annotations(Annotations::default().with_audience(vec![Role::User]));
|
||||
let assistant_only = TextContent::new("agent classification text")
|
||||
.with_annotations(Annotations::default().with_audience(vec![Role::Assistant]));
|
||||
let mixed = Message::assistant()
|
||||
.with_content(MessageContent::Text(user_only.clone()))
|
||||
.with_content(MessageContent::Text(assistant_only));
|
||||
|
||||
assert_eq!(
|
||||
planner_classification_text(&mixed).unwrap(),
|
||||
"agent classification text"
|
||||
);
|
||||
assert!(planner_classification_text(
|
||||
&Message::assistant().with_content(MessageContent::Text(user_only))
|
||||
)
|
||||
.is_err());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn planner_history_is_fixed_after_audience_projection() {
|
||||
use rmcp::model::{Annotations, Role, TextContent};
|
||||
|
||||
let hidden_separator = MessageContent::Text(
|
||||
TextContent::new("hidden separator")
|
||||
.with_annotations(Annotations::default().with_audience(vec![Role::User])),
|
||||
);
|
||||
let history = Conversation::new_unvalidated([
|
||||
Message::user().with_text("first request"),
|
||||
Message::assistant().with_content(hidden_separator),
|
||||
Message::user().with_text("second request"),
|
||||
]);
|
||||
|
||||
let provider_messages = planner_provider_messages(&history).agent_visible_messages();
|
||||
|
||||
assert_eq!(provider_messages.len(), 1);
|
||||
assert_eq!(provider_messages[0].role, Role::User);
|
||||
assert_eq!(
|
||||
provider_messages[0].as_concat_text(),
|
||||
"first request\nsecond request"
|
||||
);
|
||||
assert!(!provider_messages[0]
|
||||
.as_concat_text()
|
||||
.contains("hidden separator"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn planner_history_excludes_turn_context_events() {
|
||||
use goose::conversation::message::MessageMetadata;
|
||||
|
||||
let history = Conversation::new_unvalidated([
|
||||
Message::user().with_text("plan the refactor"),
|
||||
Message::user()
|
||||
.with_text("<turn-context>cwd /repo, todo: ship v2</turn-context>")
|
||||
.with_metadata(MessageMetadata::agent_only().with_turn_context()),
|
||||
Message::assistant().with_text("on it"),
|
||||
]);
|
||||
|
||||
let provider_text = planner_provider_messages(&history)
|
||||
.agent_visible_messages()
|
||||
.iter()
|
||||
.map(|message| message.as_concat_text())
|
||||
.collect::<Vec<_>>()
|
||||
.join("\n");
|
||||
|
||||
assert!(provider_text.contains("plan the refactor"));
|
||||
assert!(
|
||||
!provider_text.contains("turn-context"),
|
||||
"the planner prompt has no turn-context instructions, so blocks must not reach it"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_format_elapsed_time_under_60_seconds() {
|
||||
// Test sub-second duration
|
||||
@@ -3542,17 +3230,9 @@ mod tests {
|
||||
let handled = tokio::spawn(async move {
|
||||
let history = HistoryManager::new();
|
||||
session
|
||||
.handle_input(
|
||||
InputResult::Plan(input::PlanCommandOptions {
|
||||
message_text: String::new(),
|
||||
}),
|
||||
&history,
|
||||
&mut editor,
|
||||
&[],
|
||||
)
|
||||
.handle_input(InputResult::ListSkills, &history, &mut editor, &[])
|
||||
.await
|
||||
.expect("handle_input failed");
|
||||
session.run_mode
|
||||
});
|
||||
|
||||
tokio::time::sleep(Duration::from_millis(250)).await;
|
||||
@@ -3562,8 +3242,7 @@ mod tests {
|
||||
);
|
||||
|
||||
release.send(()).unwrap();
|
||||
let run_mode = handled.await.unwrap();
|
||||
assert!(matches!(run_mode, RunMode::Plan));
|
||||
handled.await.unwrap();
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
|
||||
@@ -550,26 +550,6 @@ pub fn render_text_no_newlines(text: &str, color: Option<Color>, dim: bool) {
|
||||
print!("{}", styled_text);
|
||||
}
|
||||
|
||||
pub fn render_enter_plan_mode() {
|
||||
println!(
|
||||
"\n{} {}\n",
|
||||
accent("Entering plan mode.").bold(),
|
||||
style("You can provide instructions to create a plan and then act on it. To exit early, type /endplan")
|
||||
.dim()
|
||||
);
|
||||
}
|
||||
|
||||
pub fn render_act_on_plan() {
|
||||
println!(
|
||||
"\n{}\n",
|
||||
accent("Exiting plan mode and acting on the above plan").bold(),
|
||||
);
|
||||
}
|
||||
|
||||
pub fn render_exit_plan_mode() {
|
||||
println!("\n{}\n", accent("Exiting plan mode.").bold());
|
||||
}
|
||||
|
||||
pub fn goose_mode_message(text: &str) {
|
||||
println!("\n{} {}", accent("mode:"), text);
|
||||
}
|
||||
|
||||
@@ -21,10 +21,8 @@ use super::tool_execution::{
|
||||
DECLINED_RESPONSE,
|
||||
};
|
||||
use crate::action_required_manager::ElicitationOutcome;
|
||||
use crate::agents::extension::{ExtensionConfig, ExtensionResult, ToolInfo};
|
||||
use crate::agents::extension_manager::{
|
||||
get_parameter_names, ExtensionManager, ExtensionManagerCapabilities,
|
||||
};
|
||||
use crate::agents::extension::{ExtensionConfig, ExtensionResult};
|
||||
use crate::agents::extension_manager::{ExtensionManager, ExtensionManagerCapabilities};
|
||||
use crate::agents::final_output_tool::{
|
||||
structured_output_unsupported_message, FINAL_OUTPUT_CONTINUATION_MESSAGE,
|
||||
FINAL_OUTPUT_TOOL_NAME,
|
||||
@@ -3971,32 +3969,6 @@ impl Agent {
|
||||
|
||||
Err(anyhow!("Prompt '{}' not found", name))
|
||||
}
|
||||
|
||||
pub async fn get_plan_prompt(&self, session_id: &str) -> Result<String> {
|
||||
let tools = self
|
||||
.extension_manager
|
||||
.get_prefixed_tools(session_id, None)
|
||||
.await?;
|
||||
let tools_info: Vec<_> = tools
|
||||
.into_iter()
|
||||
.map(|tool| {
|
||||
ToolInfo::new(
|
||||
&tool.name,
|
||||
tool.description
|
||||
.as_ref()
|
||||
.map(|d| d.as_ref())
|
||||
.unwrap_or_default(),
|
||||
get_parameter_names(&tool),
|
||||
None,
|
||||
)
|
||||
})
|
||||
.collect();
|
||||
|
||||
let context = HashMap::from([("tools", serde_json::to_value(tools_info)?)]);
|
||||
Ok(crate::prompt_template::render_template(
|
||||
"plan.md", &context,
|
||||
)?)
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
||||
@@ -35,10 +35,6 @@ static TEMPLATE_REGISTRY: &[(&str, &str)] = &[
|
||||
"permission_judge.md",
|
||||
"Prompt for analyzing tool operations for read-only detection",
|
||||
),
|
||||
(
|
||||
"plan.md",
|
||||
"Prompt used when goose creates step-by-step plans. CLI only",
|
||||
),
|
||||
(
|
||||
"tiny_model_system.md",
|
||||
"System prompt for tiny local models using shell command emulation",
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
You are a specialized "planner" AI. Your task is to analyze the user's request from the chat messages and create either:
|
||||
1. A detailed step-by-step plan (if you have enough information) on behalf of user that another "executor" AI agent can follow, or
|
||||
2. A list of clarifying questions (if you do not have enough information) prompting the user to reply with the needed clarifications
|
||||
|
||||
{% if (tools is defined) and tools %} ## Available Tools
|
||||
{% for tool in tools %}
|
||||
**{{tool.name}}**
|
||||
Description: {{tool.description}}
|
||||
Parameters: {{tool.parameters}}
|
||||
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
No tools are defined.
|
||||
{% endif %}
|
||||
## Guidelines
|
||||
1. Check for clarity and feasibility
|
||||
- If the user's request is ambiguous, incomplete, or requires more information, respond only with all your clarifying questions in a concise list.
|
||||
- If available tools are inadequate to complete the request, outline the gaps and suggest next steps or ask for additional tools or guidance.
|
||||
2. Create a detailed plan
|
||||
- Once you have sufficient clarity, produce a step-by-step plan that covers all actions the executor AI must take.
|
||||
- Number the steps, and explicitly note any dependencies between steps (e.g., “Use the output from Step 3 as input for Step 4”).
|
||||
- Include any conditional or branching logic needed (e.g., “If X occurs, do Y; otherwise, do Z”).
|
||||
3. Provide essential context
|
||||
- The executor AI will see only your final plan (as a user message) or your questions (as an assistant message) and will not have access to this conversation's full history.
|
||||
- Therefore, restate any relevant background, instructions, or prior conversation details needed to execute the plan successfully.
|
||||
4. One-time response
|
||||
- You can respond only once.
|
||||
- If you respond with a plan, it will appear as a user message in a fresh conversation for the executor AI, effectively clearing out the previous context.
|
||||
- If you respond with clarifying questions, it will appear as an assistant message in this same conversation, prompting the user to reply with the needed clarifications.
|
||||
5. Keep it action oriented and clear
|
||||
- In your final output (whether plan or questions), be concise yet thorough.
|
||||
- The goal is to enable the executor AI to proceed confidently, without further ambiguity.
|
||||
@@ -7,6 +7,10 @@ authors:
|
||||
|
||||
# How to Vibe Code Responsibly (with goose)
|
||||
|
||||
:::warning Outdated
|
||||
The CLI `/plan` command described in step 1 has since been removed from goose. The other practices in this post still apply; ask goose for a plan in plain language instead.
|
||||
:::
|
||||
|
||||

|
||||
|
||||
On Feb 2, 2025, Andrej Karpathy coined the phrase "[vibe coding](https://x.com/karpathy/status/1886192184808149383)". Vibe coding represents a new approach to coding where developers ask an AI agent to build something, and they go with the flow.
|
||||
@@ -46,7 +50,7 @@ Most folks define "vibe coding" as purely chaotic development with no rules. I'm
|
||||
|
||||
### 1. Create a plan
|
||||
|
||||
goose's [`/plan`](https://goose-docs.ai/docs/guides/goose-cli-commands#examples) command helps you align with your agent before any code is touched, giving you a clear understanding of what it intends to do and how it will do it.
|
||||
goose's `/plan` command helps you align with your agent before any code is touched, giving you a clear understanding of what it intends to do and how it will do it.
|
||||
|
||||
This is especially useful for tasks that span multiple files, involve side effects, or could impact critical areas of your codebase. No more guesswork—just a structured breakdown you can review and approve.
|
||||
|
||||
|
||||
@@ -5,6 +5,10 @@ authors:
|
||||
- mic
|
||||
---
|
||||
|
||||
:::warning Outdated
|
||||
The goose `/plan` mode mentioned under Advanced tips has since been removed, along with the separate planner model settings. Everything else in this post still applies.
|
||||
:::
|
||||
|
||||

|
||||
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ authors:
|
||||
---
|
||||
|
||||
:::danger Outdated
|
||||
Lead/Worker mode has been removed from goose. It has been replaced by [Planning Mode](/docs/guides/context-engineering/creating-plans), which uses a dedicated planner model with the `/plan` command. See the [multi-model guide](/docs/guides/multi-model/) for current workflows.
|
||||
Lead/Worker mode has been removed from goose, as has the Planning Mode that replaced it. See the [multi-model guide](/docs/guides/multi-model/) for current workflows.
|
||||
:::
|
||||
|
||||

|
||||
@@ -84,7 +84,7 @@ export GOOSE_MODEL="claude-4-sonnet"
|
||||
|
||||
From there, Goose takes care of the hand off, the fallback, and the recovery. You just... keep vibing.
|
||||
|
||||
If you're curious how it all works under the hood, see the [planning guide](/docs/guides/context-engineering/creating-plans).
|
||||
If you're curious how it all works under the hood, see the [multi-model guide](/docs/guides/multi-model/).
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ authors:
|
||||
---
|
||||
|
||||
:::danger Outdated
|
||||
Lead/Worker mode has been removed from goose. It has been replaced by [Planning Mode](/docs/guides/context-engineering/creating-plans), which uses a dedicated planner model with the `/plan` command. See the [multi-model guide](/docs/guides/multi-model/) for current workflows.
|
||||
Lead/Worker mode has been removed from goose, as has the Planning Mode that replaced it. See the [multi-model guide](/docs/guides/multi-model/) for current workflows.
|
||||
:::
|
||||
|
||||

|
||||
@@ -42,7 +42,7 @@ This is where it gets really cool - you can use Claude for reasoning and OpenAI
|
||||
- 🏃♂️ Handle Long Dev Sessions
|
||||
Perfect for those marathon coding sessions where you need sustained performance without breaking the bank.
|
||||
|
||||
## [Setting It Up](/docs/guides/context-engineering/creating-plans)
|
||||
## Setting It Up
|
||||
|
||||
Getting started with the Lead/Worker model is surprisingly straightforward. In the Goose desktop app, you just need to:
|
||||
|
||||
@@ -104,7 +104,7 @@ The best part? The models made smart decisions we hadn't even thought of, like a
|
||||
|
||||
## Ready to Try Multi-Model Workflows?
|
||||
|
||||
Lead/Worker mode has been removed, but goose now supports [Planning Mode](/docs/guides/context-engineering/creating-plans) for multi-model workflows. Whether you're working on documentation, building features, or tackling complex refactoring, pairing a strong planner model with a fast execution model can be a game changer.
|
||||
Lead/Worker mode has been removed, but goose still supports [multi-model workflows](/docs/guides/multi-model/). Whether you're working on documentation, building features, or tackling complex refactoring, pairing a strong reasoning model with a fast execution model can be a game changer.
|
||||
|
||||
Want to see it in action? Check out the full stream where we built this feature live:
|
||||
|
||||
|
||||
@@ -89,7 +89,7 @@ Keep individual sessions focused on specific tasks. When you complete a task or
|
||||
|
||||
**7. Planner model + focused execution**
|
||||
|
||||
Use a dedicated [planner model](/docs/guides/context-engineering/creating-plans) for complex reasoning and keep your default model focused on execution. This gives you control over cost and quality while keeping model behavior explicit and predictable.
|
||||
Use a strong [reasoning model](/docs/guides/multi-model/) for complex work and keep your default model focused on execution. This gives you control over cost and quality while keeping model behavior explicit and predictable.
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ Browse and select from a wide range of options, including:
|
||||
- **Specialized models** optimized for different use cases
|
||||
|
||||
:::tip Protip
|
||||
Want the best of both worlds? Use a dedicated [planner model](/docs/guides/context-engineering/creating-plans) for complex strategy and a faster default model for execution. Pair this with `/plan` to get strong reasoning only when you need it—saving both time and credits.
|
||||
Want the best of both worlds? Use a strong reasoning model for complex strategy and a faster default model for execution. See the [multi-model guide](/docs/guides/multi-model/) to get strong reasoning only when you need it, saving both time and credits.
|
||||
:::
|
||||
|
||||
---
|
||||
|
||||
@@ -7,6 +7,10 @@ authors:
|
||||
|
||||

|
||||
|
||||
:::warning Outdated
|
||||
The CLI `/plan` command described in this post has since been removed from goose, along with the `GOOSE_PLANNER_PROVIDER` and `GOOSE_PLANNER_MODEL` settings. The other approaches described here still work.
|
||||
:::
|
||||
|
||||
# Does Your AI Agent Need a Plan?
|
||||
|
||||
To plan or not to plan, that's the wrong question. Rather than a binary yes/no, planning exists on a spectrum. The real question is which approach fits your current task and working style.
|
||||
@@ -30,14 +34,12 @@ Rather than picking one philosophy, [goose](https://github.com/aaif-goose/goose)
|
||||
### For The Architect
|
||||
**`/plan` Mode**
|
||||
|
||||
When you enter [plan mode](/docs/guides/context-engineering/creating-plans) in the goose CLI, goose shifts into an interactive dialogue. Instead of immediately executing, it asks clarifying questions to understand your project deeply. It might ask about your tech stack preferences, authentication requirements, deployment targets, or how you want to handle error cases. This back and forth continues until goose has enough context to generate a comprehensive, actionable plan.
|
||||
When you enter plan mode in the goose CLI, goose shifts into an interactive dialogue. Instead of immediately executing, it asks clarifying questions to understand your project deeply. It might ask about your tech stack preferences, authentication requirements, deployment targets, or how you want to handle error cases. This back and forth continues until goose has enough context to generate a comprehensive, actionable plan.
|
||||
|
||||
Plan mode uses a separate planner configuration that you can customize. By setting **`GOOSE_PLANNER_PROVIDER`** and **`GOOSE_PLANNER_MODEL`** [environment variables](/docs/guides/environment-variables), you can use one model for strategic planning and a different model for execution. When you're satisfied with the plan, goose asks if you want to clear the message history and act on it, giving you a clear checkpoint before any code changes happen.
|
||||
|
||||
I used this approach recently when converting a static Vite/React project to Next.js. I understood the scope clearly since it's a common migration pattern, so I asked goose to make a comprehensive plan before starting any work. It produced an 11 phase migration plan with specific checkboxes for each step, covering everything from dependency updates to routing changes to component boundaries. Once I approved, I said "yes start" and goose executed methodically, committing after each phase.
|
||||
|
||||
[Learn more about creating plans →](/docs/guides/context-engineering/creating-plans)
|
||||
|
||||
### For The Director
|
||||
**Instruction Files**
|
||||
|
||||
|
||||
@@ -1551,7 +1551,6 @@ This method simplifies authentication and enhances security for enterprise envir
|
||||
|
||||
Beyond single-model setups, goose supports [multi-model configurations](/docs/guides/multi-model/) that can use different models and providers for specialized tasks:
|
||||
|
||||
- **Planning Mode** - Use a dedicated planner model to create detailed project breakdowns before execution
|
||||
- **Subagents** - Delegate scoped tasks to isolated sessions to keep your primary workflow focused and efficient
|
||||
|
||||
## Meta Muse Spark Reasoning Effort
|
||||
|
||||
@@ -25,7 +25,7 @@ CLI providers are useful if you:
|
||||
- need session persistence to save, resume, and export conversation history
|
||||
- want to use goose recipes and scheduled tasks to create repeatable workflows
|
||||
- prefer unified commands across different AI providers
|
||||
- want to [use multiple models together](#combining-with-planner-models) in your tasks
|
||||
- want to [use multiple models together](/docs/guides/multi-model) in your tasks
|
||||
|
||||
### Benefits
|
||||
|
||||
@@ -37,7 +37,7 @@ CLI providers are useful if you:
|
||||
#### Workflow Integration
|
||||
- **Recipe compatibility**: Use CLI providers in automated goose recipes
|
||||
- **Scheduling support**: Include in scheduled tasks and workflows
|
||||
- **Hybrid configurations**: Combine with planning mode and model-specific workflows
|
||||
- **Hybrid configurations**: Combine with subagents and model-specific workflows
|
||||
|
||||
#### Interface Consistency
|
||||
- **Unified commands**: Use the same `goose session` interface across all providers
|
||||
@@ -260,20 +260,6 @@ Once configured, you can start a goose session using these providers just like a
|
||||
goose session
|
||||
```
|
||||
|
||||
### Combining with Planner Models
|
||||
|
||||
CLI providers also work well with planning mode when you want one model for strategy and another for execution:
|
||||
|
||||
```bash
|
||||
# Use Claude Code for execution, OpenAI for planning
|
||||
export GOOSE_PROVIDER=claude-code
|
||||
export GOOSE_MODEL=default
|
||||
export GOOSE_PLANNER_PROVIDER=openai
|
||||
export GOOSE_PLANNER_MODEL=gpt-4o
|
||||
|
||||
goose session
|
||||
```
|
||||
|
||||
## Configuration Options
|
||||
|
||||
### Claude Code Configuration
|
||||
|
||||
@@ -51,8 +51,6 @@ The following settings can be configured at the root level of your config.yaml f
|
||||
| `GOOSE_CACHE_TTL` | Anthropic prompt-cache TTL; `1h` keeps the cached prefix alive across idle gaps at a higher cache-write rate. Headless runs always use `5m` | "5m", "1h" | "5m" | No |
|
||||
| `GOOSE_MODE` | [Tool execution behavior](/docs/guides/managing-tools/goose-permissions) | "auto", "approve", "chat", "smart_approve" | "auto" | No |
|
||||
| `GOOSE_MAX_TURNS` | [Maximum number of turns](/docs/guides/sessions/smart-context-management#maximum-turns) allowed without user input | Integer (e.g., 10, 50, 100) | 1000 | No |
|
||||
| `GOOSE_PLANNER_PROVIDER` | Provider for [planning mode](/docs/guides/context-engineering/creating-plans) | Same as `GOOSE_PROVIDER` options | Falls back to `GOOSE_PROVIDER` | No |
|
||||
| `GOOSE_PLANNER_MODEL` | Model for planning mode | Model name | Falls back to `GOOSE_MODEL` | No |
|
||||
| `GOOSE_TOOLSHIM` | Enable tool interpretation | true/false | false | No |
|
||||
| `GOOSE_TOOLSHIM_OLLAMA_MODEL` | Model for tool interpretation | Model name (e.g., "llama3.2") | System default | No |
|
||||
| `GOOSE_INPUT_LIMIT` | Override input token limit for Ollama (maps to `num_ctx`) | Positive integer | Model default | No |
|
||||
@@ -89,10 +87,6 @@ providers:
|
||||
configured: true
|
||||
GOOSE_TEMPERATURE: 0.7
|
||||
|
||||
# Planning Configuration
|
||||
GOOSE_PLANNER_PROVIDER: "openai"
|
||||
GOOSE_PLANNER_MODEL: "gpt-4"
|
||||
|
||||
# Tool Configuration
|
||||
GOOSE_MODE: "smart_approve"
|
||||
GOOSE_TOOLSHIM: true
|
||||
|
||||
@@ -1,348 +0,0 @@
|
||||
---
|
||||
sidebar_position: 2
|
||||
title: Creating Plans Before Working
|
||||
sidebar_label: Creating Plans
|
||||
---
|
||||
|
||||
import Card from '@site/src/components/Card';
|
||||
import styles from '@site/src/components/Card/styles.module.css';
|
||||
|
||||
Starting a project without a clear plan is like building a house without a blueprint. It can lead to:
|
||||
|
||||
* Confusion about what to do
|
||||
* Wasted time and effort
|
||||
* Projects that grow too big
|
||||
|
||||
A good plan keeps everyone on track and helps measure progress. That's why the goose CLI includes the `/plan` prompt completion command to help break down your projects into clear, manageable steps.
|
||||
|
||||
:::tip Plans in the goose Desktop
|
||||
The goose Desktop doesn't have a `plan` keyword. If you want goose Desktop to create a plan for you, you need to use a prompt like:
|
||||
|
||||
```
|
||||
"Hey goose, can you create a plan to convert my CLI project into a locally hosted web page that gives me input fields for each CLI command I can run? Please don't start the actual work"
|
||||
```
|
||||
Unless you ask goose to "create a plan", it might just start into the project work.
|
||||
:::
|
||||
|
||||
The goose CLI's plan mode is interactive, asking clarifying questions to understand your project before creating a plan. If you can provide thoughtful and informative answers to those questions, goose can generate a really useful and actionable plan.
|
||||
|
||||
## Set your planner provider and model
|
||||
In some workflows, it can be helpful to use one LLM for planning and a different one for execution. For example, GPT-4.1 tends to excel at strategic planning and breaking down complex tasks into clear, logical steps. On the other hand, Claude Sonnet 3.5 is particularly strong at writing clean, efficient code and following instructions precisely. By using GPT-4.1 to plan and Claude to execute, you can play to the strengths of both models and get better results overall.
|
||||
|
||||
The goose CLI plan mode uses two configuration values:
|
||||
|
||||
- `GOOSE_PLANNER_PROVIDER`: Which provider to use for planning
|
||||
- `GOOSE_PLANNER_MODEL`: Which model to use for planning
|
||||
|
||||
:::tip Multi-Model Alternative to Plan Mode
|
||||
You can combine planning mode with a different default execution model to balance cost, speed, and quality.
|
||||
:::
|
||||
|
||||
:::tip Customize Plan Format
|
||||
You can also customize how goose creates plans by editing the `plan.md` [prompt template](/docs/guides/context-engineering/prompt-templates).
|
||||
:::
|
||||
|
||||
### Set goose planner environment variables
|
||||
You might add these lines to your bash shell config file (.bashrc) to add the planner environment variables:
|
||||
```bash
|
||||
export GOOSE_PLANNER_PROVIDER=<my-chosen-provider>
|
||||
export GOOSE_PLANNER_MODEL=<my-chosen-model>
|
||||
```
|
||||
After you save your changes to the config file, you need to re-start your goose session so that goose can use the variables.
|
||||
|
||||
If these aren't set, goose will use your default provider and model settings. You might want to set different planning models if you find certain models are better at breaking down tasks into clear steps. However, your default model configuration is usually sufficient.
|
||||
|
||||
To verify that the planner provider is set, input the following terminal command:
|
||||
|
||||
```bash
|
||||
~ goose info -v
|
||||
```
|
||||
|
||||
In this example, the `info` command returns the current configuration and the path to the configuration file.
|
||||
|
||||
```bash
|
||||
goose Version:
|
||||
Version: 1.0.18
|
||||
|
||||
goose Locations:
|
||||
Config file: /Users/alincoln/.config/goose/config.yaml
|
||||
Sessions dir: /Users/alincoln/.local/share/goose/sessions
|
||||
Logs dir: /Users/alincoln/.local/state/goose/logs
|
||||
|
||||
goose Configuration:
|
||||
GOOSE_PROVIDER: anthropic
|
||||
GOOSE_MODEL: claude-3.5-sonnet
|
||||
GOOSE_PLANNER_PROVIDER: openai
|
||||
GOOSE_MODE: smart_approve
|
||||
GOOSE_PLANNER_MODEL: gpt-4.1
|
||||
```
|
||||
|
||||
If either `GOOSE_PLANNER_PROVIDER` or `GOOSE_PLANNER_MODEL` are not set, `GOOSE_PROVIDER` and `GOOSE_MODEL`are used to build your plan.
|
||||
|
||||
## Describe your project
|
||||
While goose can handle complex project descriptions, it works best with clear, concise ones. Focus on stating your project's purpose and desired outcomes. If these aren't clear, goose will ask clarifying questions until it fully understands your goals.
|
||||
|
||||
## A simple construction plan example
|
||||
goose can produce good plans for relatively simple projects such as the home construction example:
|
||||
|
||||
```bash
|
||||
( O)> /plan
|
||||
|
||||
Entering plan mode. You can provide instructions to create a plan and then act on it. To exit early, type /endplan
|
||||
|
||||
( O)> Build a four bedroom house
|
||||
◓ Measuring semantic distance...
|
||||
|
||||
I need to gather more information before creating a detailed house-building plan. Please provide clarification on the following:
|
||||
|
||||
1. What is the purpose of this plan? Are you looking for architectural designs, construction steps, or a project management timeline?
|
||||
2. What is your budget range for this four-bedroom house?
|
||||
3. What is the approximate square footage or size requirements?
|
||||
4. Do you have a specific location or lot already selected? What are the dimensions and any zoning restrictions?
|
||||
5. Are there any specific architectural styles or features you want included?
|
||||
6. How many bathrooms and other rooms (e.g., kitchen, living room, dining room, garage) do you want?
|
||||
7. Do you have any specific sustainability or energy efficiency requirements?
|
||||
8. What is your timeline for completion?
|
||||
|
||||
( O)> 1 construction steps and a project management timeline. 2 $600,000. 3 4,000 sq feet. 4 the lot is not yet selected. 5 one story rambler. 6 four bedrooms, two ful baths, a kitchen, diningroom, family room, and garage. 7 the house must be efficient and powered by solar energy. 8 complete in six months.
|
||||
◓ Taming tensors... I'll create a detailed plan for building a 4,000 sq ft, one-story rambler with four bedrooms, two full bathrooms, kitchen, dining room, family room, garage, and home office. The house will be energy efficient with solar power, with a $600,000 budget and 6-month timeline.
|
||||
|
||||
◇ Do you want to clear message history & act on this plan?
|
||||
│ Yes
|
||||
│
|
||||
|
||||
Exiting plan mode and acting on the above plan
|
||||
|
||||
### Introduction to Building a 4,000 Sq Ft Rambler
|
||||
To create a detailed plan for your 4,000 sq ft, one-story rambler, we need to consider several factors including design, energy efficiency, budget, and timeline. Given your requirements, here's an overview of how to approach this project:
|
||||
|
||||
### Step 1: Design and Planning
|
||||
- **Architectural Design**: Hire an architect to design the house, ensuring it meets your space requirements and is energy efficient. Consider factors like natural lighting, insulation, and window placement.
|
||||
- **Floor Plan**: Create a floor plan that includes four bedrooms, two full bathrooms, a kitchen, dining room, family room, garage, and home office. Ensure the layout is functional and spacious.
|
||||
- **Land Preparation**: Ensure the building site is prepared, including clearing the land, grading, and preparing the foundation.
|
||||
|
||||
### Step 2: Energy Efficiency and Solar Power
|
||||
- **Solar Power System**: Design and install a solar power system that can meet the energy needs of a 4,000 sq ft house. This may include a large solar panel array and a battery storage system for nighttime and cloudy days.
|
||||
- **Insulation and Windows**: Use high-quality insulation in the walls, floor, and ceiling to minimize heat loss. Install energy-efficient windows that allow natural light in while keeping the heat or cold out.
|
||||
- **Energy-Efficient Appliances**: Specify energy-efficient appliances and lighting to minimize energy consumption.
|
||||
|
||||
### Step 3: Budgeting
|
||||
- **Construction Costs**: Allocate approximately $200-250 per sq ft for construction, which translates to $800,000-$1,000,000 for a 4,000 sq ft house. However, your budget is $600,000, so you'll need to optimize costs without compromising on quality and energy efficiency.
|
||||
- **Solar Power System Costs**: Budget an additional $20,000 to $50,000 for the solar power system, depending on its size and complexity.
|
||||
- **Contingency Fund**: Set aside 10-20% of the budget for unexpected expenses.
|
||||
|
||||
### Step 4: Timeline
|
||||
- **Month 1-2: Design and Planning**: Complete the architectural design, obtain necessary permits, and prepare the building site.
|
||||
- **Month 3-4: Foundation and Framing**: Lay the foundation, frame the house, and install the roof.
|
||||
- **Month 5: Installation of Electrical, Plumbing, and HVAC Systems**: Install the solar power system, electrical, plumbing, and HVAC systems.
|
||||
- **Month 6: Finishing Work**: Complete the interior finishing work, including installation of energy-efficient appliances, flooring, and fixtures.
|
||||
|
||||
### Conclusion
|
||||
Building a 4,000 sq ft, energy-efficient rambler with solar power within a $600,000 budget and 6-month timeline is challenging but feasible with careful planning and design. It's essential to work closely with your architect, contractor, and solar power system installer to ensure the project stays on track and within budget.
|
||||
|
||||
Given that no extensions are currently available for more specific tools or data sources, consider the following steps to proceed with your project:
|
||||
|
||||
* Search for available extensions using the <function=platform__search_available_extensions>{}</function>
|
||||
|
||||
```
|
||||
The home construction plan remains high-level because goose's current models specialize in technology and software development rather than construction. This is why projects like our first example—building a web application—receive more detailed planning and specific guidance.
|
||||
|
||||
### Create a separate plan for plan sub-steps
|
||||
Let's return to the home construction example. While the plan includes hiring an architect, this high-level step needs more detail – such as what type of architect to hire and how to navigate the selection process.
|
||||
|
||||
```
|
||||
- **Architectural Design**: Hire an architect to design the house, ensuring it meets your space requirements and is energy efficient. Consider factors like natural lighting, insulation, and window placement.
|
||||
```
|
||||
If you exit plan mode while reviewing your construction plan, you can always resume it to continue working with goose.
|
||||
|
||||
```
|
||||
( O)> /plan hire an architect
|
||||
|
||||
Entering plan mode. You can provide instructions to create a plan and then act on it. To exit early, type /endplan
|
||||
|
||||
◓ Synchronizing flock algorithms... I need some clarifying questions to better understand your request about hiring an architect:
|
||||
|
||||
1. What is your location or preferred region for the architect to be based in?
|
||||
2. Do you have a specific budget range for architectural services?
|
||||
3. Are you looking for an architect with specific expertise (e.g., energy-efficient homes, modern design, traditional styles)?
|
||||
4. Do you need full architectural services (design through construction oversight) or just certain phases?
|
||||
5. Do you have a timeline for when you'd like to begin working with an architect?
|
||||
6. Have you already purchased land for your home, or will the architect need to help evaluate potential sites?
|
||||
7. Are there any specific certifications or qualifications you're looking for in an architect?
|
||||
8. Would you prefer to work with a solo practitioner or a larger architectural firm?
|
||||
9. Do you have any examples of architectural styles or specific homes you admire?
|
||||
10. How involved do you want to be in the design process?
|
||||
```
|
||||
|
||||
After gathering information through clarifying questions, goose creates a detailed plan for hiring an architect. This sub-plan integrates with the larger home construction project, with steps that reflect and support the overall construction context.
|
||||
|
||||
## A development project example
|
||||
In this example, a developer has written a CLI in Python that interacts with the Contentful CMS to let a user search for strings and replace them with new strings. As a website, the search/replace feature would be more usable and also allow for a larger set of features. The developer is using the goose CLI to plan the conversion project.
|
||||
|
||||
If goose believes the project can be completed in many different ways and using a wide variety of components, it will ask you a clarifying question for each of these decision points. For example, if you start a plan like this:
|
||||
|
||||
```bash
|
||||
( O)> /plan
|
||||
|
||||
Entering plan mode. You can provide instructions to create a plan and then act on it. To exit early, type /endplan
|
||||
|
||||
( O)> Convert the CLI built by search_replace_routes.py into a web page
|
||||
```
|
||||
goose parses your project description, consults with the LLM mode you've configured, and then if it needs more information, starts a round of clarifying questions.
|
||||
|
||||
## Clarifying questions
|
||||
Converting a Python CLI into a website seems simple enough but goose will have questions about things like styling, authentication, features, technology stack, and more. You might see questions like this:
|
||||
|
||||
```bash
|
||||
1. Should the application support any keyboard shortcuts for common actions?
|
||||
2. Would you like the application to remember user preferences (like case sensitivity setting) between sessions?
|
||||
3. Should there be any form of notification when operations complete successfully?
|
||||
4. How should the application handle very large text fields that might be difficult to display in the three-column layout?
|
||||
5. Are there any specific CI/CD requirements for deployment to AWS?
|
||||
|
||||
```
|
||||
You can answer the questions one at a time or you can batch your answers:
|
||||
|
||||
```bash
|
||||
( O)> 1 no keyboard shortcuts. 2 do not remember preferences. 3 on success, open a dialog that says "success". 4 Truncate to 30 characters before the string to replace and then 30 characters after the string to replace.5 no CI/CD requirements
|
||||
```
|
||||
|
||||
|
||||
:::tip
|
||||
When goose requests a project artifact like source code during plan mode, you'll need to paste the content directly into the chat. Simply copying the file contents and prefixing it with a brief description like 'Here's the requested code:' is sufficient. Note that providing just a file path won't work in plan mode.
|
||||
:::
|
||||
|
||||
When answering multiple questions, number your responses to match each question. For example, instead of answering with a simple 'no' or 'don't remember', provide context like '2. Do not store my preferences.' This helps goose track which questions have been answered and prevents repeated questions.
|
||||
|
||||
In complex projects like converting a CLI to a website, goose may ask multiple rounds of clarifying questions. Each round typically stems from new information in your previous answers or when additional details are needed about specific aspects of your project.
|
||||
|
||||
If you've answered _all_ of goose's questions and it has no more questions, goose will generate the plan. Other times, you might think goose will never run out of questions. If you want your plan and don't want to answer more questions, you can simply ask for a "generic" plan:
|
||||
|
||||
```bash
|
||||
I still need some critical information to create a comprehensive plan:
|
||||
|
||||
1. What specific functionality does your Python script perform with Contentful? Could you share the actual code or describe how it interacts with the Contentful API to search and replace content?
|
||||
2. What are the 5 predefined keys/inputs you mentioned earlier?
|
||||
3. Should the web application include all the command-line options from the script (environment, status, case-sensitive, partial-match, dry-run)?
|
||||
4. How should the application handle errors from the Contentful API?
|
||||
5. Should the application maintain any history of previous search/replace operations?
|
||||
|
||||
Without this information, I can only provide a generic plan that might not accurately capture your requirements.
|
||||
( O)> please provide a generic plan
|
||||
```
|
||||
While goose creates a standardized plan format, it customizes the content based on your answers. goose can generate the code needed to implement the steps of the plan it produces. You should review the plan and any code that it generates before ending plan mode (`/endplan`) and asking goose to implement the plan.
|
||||
|
||||
Below is a sample plan for this project, with the generated website code omitted for brevity:
|
||||
|
||||
```bash
|
||||
# Plan for Converting CLI Script to React Web Application
|
||||
|
||||
## Step 1: Set up the React project and dependencies
|
||||
1. Create a new React application using Create React App
|
||||
2. Install necessary dependencies
|
||||
3. Set up project structure
|
||||
src/
|
||||
├── components/
|
||||
│ ├── Auth/
|
||||
│ ├── Layout/
|
||||
│ ├── Search/
|
||||
│ ├── Results/
|
||||
│ └── History/
|
||||
├── services/
|
||||
│ ├── contentful.ts
|
||||
│ ├── auth.ts
|
||||
│ └── storage.ts
|
||||
├── utils/
|
||||
│ ├── validation.ts
|
||||
│ └── helpers.ts
|
||||
├── contexts/
|
||||
│ └── AppContext.tsx
|
||||
└── pages/
|
||||
├── Home.tsx
|
||||
├── Search.tsx
|
||||
└── History.tsx
|
||||
|
||||
## Step 2: Implement authentication with Okta
|
||||
1. Create an Okta application in the Okta Developer Console
|
||||
2. Configure the Okta authentication settings in the application
|
||||
3. Implement protected routes using Okta's React components
|
||||
## Step 3: Create the layout and UI components with Material UI
|
||||
1. Implement the main layout with Material UI
|
||||
2. Create the search form component
|
||||
3. Create the results display component with three columns
|
||||
4. Implement the "Load More" pagination component
|
||||
## Step 4: Implement Contentful service
|
||||
1. Create a service for interacting with Contentful
|
||||
## Step 5: Implement local storage service for history
|
||||
1. Create a service for managing search history in localStorage
|
||||
## Step 6: Implement validation utilities
|
||||
1. Create utility functions for input validation
|
||||
## Step 7: Implement main pages
|
||||
1. Create the Search page
|
||||
2. Create the History page
|
||||
## Step 8: Set up routing and main application
|
||||
1. Create the main App component
|
||||
## Step 9: Implement error handling and loading states
|
||||
1. Create error boundary components
|
||||
2. Add loading indicators for API operations
|
||||
3. Implement error messages display
|
||||
|
||||
## Step 10: Set up deployment configuration
|
||||
1. Create AWS deployment configuration
|
||||
## Step 11: Testing and quality assurance
|
||||
1. Write unit tests for key components
|
||||
2. Implement integration tests for the main workflows
|
||||
3. Perform manual testing of the application
|
||||
|
||||
This plan provides a comprehensive framework for converting your CLI script to a React web application with Material UI and Okta authentication. You'll need to adapt specific parts based on your exact requirements and the functionality of your original script.
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
## Basic usage
|
||||
You need to have an active goose session before you can put the CLI into plan mode. If you are going to dedicate a session to creating a plan, you should give your new session a name as in the following example:
|
||||
|
||||
```bash
|
||||
~ goose session -n web-project-plan
|
||||
starting session | provider: databricks model: databricks-meta-llama
|
||||
session id: 20251110_5
|
||||
working directory: /Users/alincoln
|
||||
|
||||
goose is running! Enter your instructions, or try asking what goose can do.
|
||||
```
|
||||
To enter planning mode, type `/plan`. Optionally, you can append your plan description to the prompt completion command.
|
||||
```bash
|
||||
( O)> /plan Build a four bedroom house
|
||||
```
|
||||
|
||||
Plan mode in the CLI is a special interaction mode where goose helps break down tasks into manageable steps. If you want to close the plan mode and return to the active session, type `/endplan`.
|
||||
|
||||
```bash
|
||||
( O)> /endplan
|
||||
```
|
||||
|
||||
## Additional Resources
|
||||
|
||||
import ContentCardCarousel from '@site/src/components/ContentCardCarousel';
|
||||
import blogBanner from '@site/blog/2025-12-19-does-your-ai-agent-need-a-plan/blog-banner.png';
|
||||
|
||||
<ContentCardCarousel
|
||||
items={[
|
||||
{
|
||||
type: 'blog',
|
||||
title: 'Does Your AI Agent Need a Plan?',
|
||||
description: 'Knowing when and how to plan with an AI agent can produce better results.',
|
||||
thumbnailUrl: blogBanner,
|
||||
linkUrl: '/blog/2025/12/19/does-your-ai-agent-need-a-plan',
|
||||
date: '2025-12-19',
|
||||
duration: '7 min read'
|
||||
},
|
||||
{
|
||||
type: 'topic',
|
||||
title: 'Planning Complex Tasks',
|
||||
description: 'Learn how to use the Plan feature to break down complex tasks into manageable, executable steps.',
|
||||
linkUrl: '/docs/tutorials/plan-feature-devcontainer-setup',
|
||||
}
|
||||
]}
|
||||
/>
|
||||
@@ -55,11 +55,6 @@ import styles from '@site/src/components/Card/styles.module.css';
|
||||
description="Delegate focused tasks to isolated goose instances that can run sequentially or in parallel."
|
||||
link="/docs/guides/context-engineering/subagents"
|
||||
/>
|
||||
<Card
|
||||
title="Creating Plans"
|
||||
description="Use planning mode to break complex work into clear, manageable steps before goose starts implementation."
|
||||
link="/docs/guides/context-engineering/creating-plans"
|
||||
/>
|
||||
<Card
|
||||
title="Persistent Instructions"
|
||||
description="Inject critical reminders into goose's working memory every turn. Ideal for security guardrails and behavioral rules that must never be forgotten."
|
||||
|
||||
@@ -24,7 +24,7 @@ When you customize a template:
|
||||
|
||||
Your changes can range from major updates to minor adjustments such as:
|
||||
- Edit `system.md` to have goose respond in Dutch by adding an instruction to "Reply in Dutch"
|
||||
- Edit `plan.md` to add time estimates by adding instructions to "Include an estimated time for each step (e.g., "~5 min", "~30 min", "~2 hours")."
|
||||
- Edit `compaction.md` to keep more detail when summarizing by adding an instruction to "Preserve every file path and command that was run."
|
||||
|
||||
See [Template Variable Syntax](#template-variable-syntax) for important information about modifying template variables.
|
||||
|
||||
@@ -95,7 +95,6 @@ The following default templates can be customized.
|
||||
| [apps_iterate.md](https://github.com/aaif-goose/goose/blob/main/crates/goose/src/prompts/apps_iterate.md) | Prompt for updating existing standalone apps (in development) | Desktop only |
|
||||
| [compaction.md](https://github.com/aaif-goose/goose/blob/main/crates/goose/src/prompts/compaction.md) | Prompt for summarizing conversation history when context limits are reached | Desktop and CLI |
|
||||
| [permission_judge.md](https://github.com/aaif-goose/goose/blob/main/crates/goose/src/prompts/permission_judge.md) | Prompt for analyzing tool operations for read-only detection | Desktop and CLI |
|
||||
| [plan.md](https://github.com/aaif-goose/goose/blob/main/crates/goose/src/prompts/plan.md) | Instructions for creating detailed, actionable plans with clarifying questions | CLI only |
|
||||
| [subagent_system.md](https://github.com/aaif-goose/goose/blob/main/crates/goose/src/prompts/subagent_system.md) | System prompt for subagents spawned to handle specific tasks | Desktop and CLI |
|
||||
| [tiny_model_system.md](https://github.com/aaif-goose/goose/blob/main/crates/goose/src/prompts/tiny_model_system.md) | System prompt for tiny local models using shell command emulation | CLI |
|
||||
| [session_name.md](https://github.com/aaif-goose/goose/blob/main/crates/goose/src/prompts/session_name.md) | Prompt for generating short session names from conversation history | Desktop and CLI |
|
||||
|
||||
@@ -87,23 +87,6 @@ export CLAUDE_THINKING_TYPE=disabled
|
||||
To see Claude's thinking output in the **CLI**, you also need to set `GOOSE_CLI_SHOW_THINKING=1`. In **goose Desktop**, thinking output is shown automatically in a collapsible "Show reasoning" toggle.
|
||||
:::
|
||||
|
||||
### Planning Mode Configuration
|
||||
|
||||
These variables control goose's [planning functionality](/docs/guides/context-engineering/creating-plans).
|
||||
|
||||
| Variable | Purpose | Values | Default |
|
||||
|----------|---------|---------|---------|
|
||||
| `GOOSE_PLANNER_PROVIDER` | Specifies which provider to use for planning mode | [See available providers](/docs/getting-started/providers#available-providers) | Falls back to GOOSE_PROVIDER |
|
||||
| `GOOSE_PLANNER_MODEL` | Specifies which model to use for planning mode | Model name (e.g., "gpt-4", "claude-sonnet-4-20250514")| Falls back to GOOSE_MODEL |
|
||||
|
||||
**Examples**
|
||||
|
||||
```bash
|
||||
# Planning mode with different model
|
||||
export GOOSE_PLANNER_PROVIDER="openai"
|
||||
export GOOSE_PLANNER_MODEL="gpt-4"
|
||||
```
|
||||
|
||||
### Provider Retries
|
||||
|
||||
Configurable retry parameters for LLM providers.
|
||||
@@ -663,4 +646,3 @@ When deploying goose in enterprise environments, administrators might need to co
|
||||
- Environment variables take precedence over configuration files.
|
||||
- For security-sensitive variables (like API keys), consider using the system keyring instead of environment variables.
|
||||
- Some variables may require restarting goose to take effect.
|
||||
- When using the planning mode, if planner-specific variables are not set, goose will fall back to the main model configuration.
|
||||
|
||||
@@ -790,11 +790,11 @@ Once you're in an interactive session (via `goose session` or `goose run --inter
|
||||
- **`/?` or `/help`** - Display the help menu
|
||||
- **`/builtin <names>`** - Add builtin extensions by name (comma-separated)
|
||||
- **`/clear`** - Clear the current chat history
|
||||
- **`/endplan`** - Exit plan mode and return to 'normal' goose mode
|
||||
- **`/exit` or `/quit`** - Exit the session
|
||||
- **`/extension <command>`** - Add a stdio extension (format: ENV1=val1 command args...)
|
||||
- **`/mode <name>`** - Set the goose mode to use ('auto', 'approve', 'chat', 'smart_approve')
|
||||
- **`/plan <message_text>`** - Enter 'plan' mode with optional message. Create a plan based on the current messages and ask user if they want to act on it
|
||||
- **`/model [name]`** - Show the current model, or switch models for this session while keeping the same provider
|
||||
- **`/model --provider <name> [model]`** - Switch to a different provider, optionally specifying a model
|
||||
- **`/prompt <n> [--info] [key=value...]`** - Get prompt info or execute a prompt
|
||||
- **`/prompts [--extension <name>]`** - List all available prompts, optionally filtered by extension
|
||||
- **`/compact`** - Compact and summarize the current conversation to reduce context length while preserving key information
|
||||
@@ -805,9 +805,6 @@ Once you're in an interactive session (via `goose session` or `goose run --inter
|
||||
|
||||
**Examples:**
|
||||
```bash
|
||||
# Create a plan for triaging test failures
|
||||
/plan let's create a plan for triaging test failures
|
||||
|
||||
# List all prompts from the developer extension
|
||||
/prompts --extension developer
|
||||
|
||||
|
||||
@@ -19,19 +19,19 @@ import VideoCarousel from '@site/src/components/VideoCarousel';
|
||||
<h2 className={styles.categoryTitle}>📚 Documentation & Guides</h2>
|
||||
<div className={styles.cardGrid}>
|
||||
<Card
|
||||
title="Planner + Execution Model Setup"
|
||||
description="Use a dedicated planner model for strategic reasoning and a separate default model for execution."
|
||||
link="/docs/guides/context-engineering/creating-plans"
|
||||
title="Switching Models Mid-Session"
|
||||
description="Use the /model command to change models without losing your session, keeping the same provider or switching to another."
|
||||
link="/docs/guides/goose-cli-commands#slash-commands"
|
||||
/>
|
||||
<Card
|
||||
title="Creating Plans Before Working"
|
||||
description="Manual planning mode that optionally uses a dedicated model to break complex projects into detailed, actionable steps."
|
||||
link="/docs/guides/context-engineering/creating-plans"
|
||||
title="Subagents"
|
||||
description="Delegate focused tasks to isolated goose instances, each able to run its own provider and model."
|
||||
link="/docs/guides/context-engineering/subagents"
|
||||
/>
|
||||
<Card
|
||||
title="Planning Complex Tasks"
|
||||
description="Uses the Plan feature to transform a complex devcontainer setup into a systematic, executable roadmap."
|
||||
link="/docs/tutorials/plan-feature-devcontainer-setup"
|
||||
title="Context Engineering"
|
||||
description="Shape what goose keeps in context across a session, including compaction and persistent instructions."
|
||||
link="/docs/guides/context-engineering"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -57,9 +57,6 @@ goose Desktop lets you [customize the sidebar](/docs/guides/desktop-navigation)
|
||||
### Keep goose updated
|
||||
Regularly [update](/docs/guides/updating-goose) goose to benefit from the latest features, bug fixes, and performance improvements.
|
||||
|
||||
### Use a Dedicated Planner Model
|
||||
Use [planning mode](/docs/guides/context-engineering/creating-plans) with a dedicated planner model for complex reasoning, while keeping a faster default model for everyday execution.
|
||||
|
||||
### Make Recipes Safe to Re-run
|
||||
Write [recipes](/docs/guides/recipes/session-recipes) that check your current state before acting, so they can be run multiple times without causing any errors or duplication.
|
||||
|
||||
|
||||
@@ -302,10 +302,6 @@ export GOOSE_CLI_MIN_PRIORITY=0.2 # Reduce verbose output
|
||||
### Advanced Configuration
|
||||
|
||||
```bash
|
||||
# For complex workflows requiring dedicated planning
|
||||
export GOOSE_PLANNER_PROVIDER=openai
|
||||
export GOOSE_PLANNER_MODEL=gpt-4o
|
||||
|
||||
# Security and permissions
|
||||
export GOOSE_ALLOWLIST=https://company.com/allowed-extensions.json
|
||||
```
|
||||
|
||||
@@ -1,457 +0,0 @@
|
||||
---
|
||||
title: "Planning Complex Tasks"
|
||||
description: "Learn how to use goose's Plan feature to break down complex tasks into manageable, executable steps."
|
||||
---
|
||||
|
||||
# Planning Complex Tasks
|
||||
|
||||
*Transform overwhelming tasks into systematic, step-by-step execution plans*
|
||||
|
||||
|
||||
Using goose for large, complex tasks can feel overwhelming, especially when you're unsure of exactly how you want to approach it in advance. I experienced this when I needed to set up a complex development environment for an [API course](https://github.com/LinkedInLearning/java-automated-api-testing-with-rest-assured-5989068) I published. Between Docker configurations, database initialization, devcontainer setup, and GitHub Codespaces integration, there are dozens of moving pieces that need to work together perfectly. One missing configuration or incorrect dependency can derail the entire process.
|
||||
|
||||
This tutorial shows you how to use goose's [Plan feature](/docs/guides/context-engineering/creating-plans) to transform a complex devcontainer setup into a systematic, executable roadmap. You'll learn how to brainstorm with goose, refine your requirements, and let goose create both a detailed plan and implementation checklist.
|
||||
|
||||
## What You'll Learn
|
||||
|
||||
By the end of this tutorial, you'll understand how to:
|
||||
|
||||
- Use goose's Plan feature to break down complex technical projects
|
||||
- Brainstorm and refine requirements through AI-assisted conversation
|
||||
- Transform high-level goals into detailed, executable steps
|
||||
- Create comprehensive checklists for validation and quality assurance
|
||||
- Execute plans systematically with clear deliverables
|
||||
|
||||
## The Challenge: Complete Codespaces Environment
|
||||
|
||||
Our goal is to create a GitHub repository that provides a complete development environment for API testing with Rest Assured. When students open the repository in GitHub Codespaces, they should have:
|
||||
|
||||
- **Automated Setup**: Zero manual configuration required
|
||||
- **API Server**: REST API running automatically
|
||||
- **Database**: MySQL with pre-loaded schema and test data
|
||||
- **Development Tools**: Java 17, Docker, and necessary VS Code extensions
|
||||
- **One-Click Experience**: Everything starts with `docker-compose up -d`
|
||||
|
||||
This involves coordinating multiple technologies: Docker, MySQL, PHP, Java, devcontainers, and GitHub Codespaces.
|
||||
|
||||
|
||||
## Step 1: Initial Brainstorming Session
|
||||
|
||||
Let's start by having a brainstorming conversation with goose to clarify our requirements.
|
||||
|
||||
:::info Planning in Desktop vs CLI
|
||||
The goose Desktop doesn't have a `/plan` keyword like the CLI. In Desktop, you need to explicitly ask goose to create a plan:
|
||||
|
||||
```
|
||||
"Hey goose, can you create a plan to set up my GitHub repo for Codespaces with automatic Docker startup? Please don't start the actual work yet."
|
||||
```
|
||||
|
||||
In the CLI, you can enter plan mode with `/plan` and goose will ask clarifying questions before generating the plan. Unless you specifically ask goose Desktop to "create a plan", it might jump straight into implementation.
|
||||
:::
|
||||
|
||||
### Starting the Conversation
|
||||
|
||||
**You:** _"I need help setting up a GitHub repository for automated API testing. Students should be able to open it in GitHub Codespaces and immediately start writing tests without any manual setup. Can you help me think through what's needed?"_
|
||||
|
||||
**goose:** _"I'd be happy to help you design this automated setup! Let me ask some clarifying questions to understand your requirements better:_
|
||||
|
||||
1. What type of API are you working with? (REST, GraphQL, etc.)
|
||||
2. What testing framework do you want students to use?
|
||||
3. Do you need a real database with test data, or can you use mocked responses?
|
||||
4. What programming language should students use for their tests?
|
||||
5. Are there specific API endpoints or functionality they'll be testing?"
|
||||
|
||||
### Refining Requirements
|
||||
|
||||
**You:** _"It's a REST API built in PHP that students will test using Rest Assured in Java. They need a real MySQL database with actual test data so they can practice realistic scenarios. The API has endpoints for managing products and categories in an e-commerce system."_
|
||||
|
||||
**goose:** _"Perfect! That gives me a clear picture. A few more questions to ensure we design this correctly:_
|
||||
|
||||
1. Do you already have the PHP API code, or do we need to create it?
|
||||
2. What version of Java should the environment support?
|
||||
3. Should the MySQL database be populated with sample products and categories?
|
||||
4. Do you want any specific VS Code extensions pre-installed?
|
||||
5. What's your timeline for getting this working?"
|
||||
|
||||
**You:** _"I have the existing PHP API code that currently runs in MAMP. I need Java 17 for Rest Assured compatibility. Yes, the database should have sample data. Please include Java and Docker extensions for VS Code."_
|
||||
|
||||
## Step 2: Creating the Detailed Plan
|
||||
|
||||
Now that we've clarified the requirements, let's ask goose to create a comprehensive plan.
|
||||
|
||||
### Requesting the Plan
|
||||
|
||||
**You:** _"Based on our discussion, can you create a detailed plan for setting up this GitHub repository? I want a step-by-step approach that covers all the technical requirements we discussed. Please include specific deliverables and a way to validate each step."_
|
||||
|
||||
### The Generated Plan
|
||||
|
||||
goose will generate a comprehensive plan similar to this:
|
||||
|
||||
<details>
|
||||
<summary>GitHub Codespaces API Testing Environment Setup Plan</summary>
|
||||
|
||||
```markdown
|
||||
# GitHub Codespaces API Testing Environment Setup Plan
|
||||
|
||||
## Project Overview
|
||||
Create a GitHub repository that automatically provisions a complete development environment for API testing with Rest Assured, including PHP API server, MySQL database, and Java development tools.
|
||||
|
||||
## Phase 1: Repository Structure and API Integration
|
||||
|
||||
### 1.1 Handle the API Files
|
||||
- **Deliverable**: Organized API codebase in repository
|
||||
- **Tasks**:
|
||||
- Place `/api-server/` directory at repository root
|
||||
- Organize PHP files into logical structure:
|
||||
|
||||
/api-server/
|
||||
category/
|
||||
config/
|
||||
objects/
|
||||
product/
|
||||
ApiTestingDB.sql
|
||||
|
||||
|
||||
- **Validation**: All PHP files accessible and properly organized
|
||||
|
||||
### 1.2 Database Schema and Test Data
|
||||
- **Deliverable**: SQL file with schema and sample data
|
||||
- **Tasks**:
|
||||
- Review existing `ApiTestingDB.sql` file
|
||||
- Ensure it includes both schema creation and sample data insertion
|
||||
- Verify sample data covers realistic e-commerce scenarios
|
||||
- **Validation**: SQL file executes without errors and populates test data
|
||||
|
||||
## Phase 2: Containerization
|
||||
|
||||
### 2.1 Dockerize the API Server
|
||||
- **Deliverable**: `api-server/Dockerfile`
|
||||
- **Tasks**:
|
||||
- Create Dockerfile using `php:8.1-apache` base image
|
||||
- Install required PHP extensions (`pdo_mysql`)
|
||||
- Configure proper file permissions and Apache settings
|
||||
|
||||
- **Example Configuration**:
|
||||
|
||||
FROM php:8.1-apache
|
||||
RUN docker-php-ext-install pdo pdo_mysql
|
||||
COPY . /var/www/html/
|
||||
|
||||
- **Validation**: Docker image builds successfully and serves PHP files
|
||||
|
||||
### 2.2 Database Container Setup
|
||||
- **Deliverable**: MySQL service configuration in docker-compose.yml
|
||||
- **Tasks**:
|
||||
- Configure MySQL 5.7 container with proper environment variables
|
||||
- Set up automatic schema initialization using volume mounting
|
||||
- Configure networking for PHP-MySQL communication
|
||||
- **Database Credentials**:
|
||||
| Setting | Value |
|
||||
|----------|-------|
|
||||
| Host | `mysql` |
|
||||
| Database | `api_db` |
|
||||
| Username | `user` |
|
||||
| Password | `password` |
|
||||
|
||||
- **Validation**: Database starts automatically and initializes with test data
|
||||
|
||||
### 2.3 Service Orchestration
|
||||
- **Deliverable**: Complete `docker-compose.yml`
|
||||
- **Tasks**:
|
||||
- Define both API server and MySQL services
|
||||
- Configure proper service dependencies
|
||||
- Set up port mapping for external access
|
||||
- Configure volume mounting for database initialization
|
||||
- **Example Configuration**:
|
||||
|
||||
version: '3.8'
|
||||
services:
|
||||
mysql:
|
||||
image: mysql:5.7
|
||||
restart: always
|
||||
environment:
|
||||
MYSQL_ROOT_PASSWORD: password
|
||||
MYSQL_DATABASE: api_db
|
||||
MYSQL_USER: user
|
||||
MYSQL_PASSWORD: password
|
||||
ports:
|
||||
- "3306:3306"
|
||||
volumes:
|
||||
- ./api-server/sql:/docker-entrypoint-initdb.d
|
||||
|
||||
api-server:
|
||||
build: ./api-server
|
||||
ports:
|
||||
- "8888:80"
|
||||
depends_on:
|
||||
- mysql
|
||||
|
||||
- **Validation**: Both services start correctly and can communicate
|
||||
|
||||
## Phase 3: Database Connection Configuration
|
||||
|
||||
### 3.1 Update PHP Database Configuration
|
||||
- **Deliverable**: Updated `api-server/config/database.php`
|
||||
- **Tasks**:
|
||||
- Modify connection settings to use Docker networking
|
||||
- Update host from `localhost` to `mysql`
|
||||
- Verify credentials match docker-compose environment variables
|
||||
- **Validation**: PHP API can successfully connect to MySQL container
|
||||
|
||||
## Phase 4: Codespaces Integration
|
||||
|
||||
### 4.1 Devcontainer Configuration
|
||||
- **Deliverable**: `.devcontainer/devcontainer.json`
|
||||
- **Tasks**:
|
||||
- Create devcontainer configuration for Java 17 development
|
||||
- Enable Docker-in-Docker functionality
|
||||
- Configure automatic container startup
|
||||
- Pre-install necessary VS Code extensions
|
||||
- **Example Configuration**:
|
||||
|
||||
{
|
||||
"name": "API Testing Environment",
|
||||
"image": "mcr.microsoft.com/devcontainers/java:17",
|
||||
"features": {
|
||||
"docker-in-docker": "latest"
|
||||
},
|
||||
"postCreateCommand": "docker-compose up -d",
|
||||
"customizations": {
|
||||
"vscode": {
|
||||
"extensions": [
|
||||
"vscjava.vscode-java-pack",
|
||||
"ms-azuretools.vscode-docker"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- **Validation**: Codespace launches with all tools available
|
||||
|
||||
## Phase 5: Testing and Validation
|
||||
|
||||
### 5.1 API Access Verification
|
||||
- **Tasks**:
|
||||
- Verify API accessible at `http://localhost:8888`
|
||||
- Test key endpoints (products, categories)
|
||||
- Confirm database queries return expected data
|
||||
- **Validation**: All API endpoints respond correctly
|
||||
|
||||
### 5.2 Codespaces Integration Testing
|
||||
- **Tasks**:
|
||||
- Open repository in GitHub Codespaces
|
||||
- Verify automatic Docker startup
|
||||
- Test VS Code extensions functionality
|
||||
- Confirm Java 17 availability
|
||||
- **Validation**: Complete environment ready for student use
|
||||
|
||||
## Quality Assurance Checklist
|
||||
|
||||
### ✅ API Server and Database Setup
|
||||
- [ ] `/api-server/` placed at repository root
|
||||
- [ ] All required directories present (category/, config/, objects/, product/)
|
||||
- [ ] `ApiTestingDB.sql` includes schema and test data
|
||||
- [ ] `Dockerfile` uses `php:8.1-apache` with `pdo_mysql` extension
|
||||
- [ ] `docker-compose.yml` defines both MySQL and API services
|
||||
- [ ] Services configured with correct dependencies and port mapping
|
||||
|
||||
### ✅ Database Configuration
|
||||
- [ ] PHP database config uses Docker networking (`mysql` host)
|
||||
- [ ] Credentials match between PHP config and docker-compose
|
||||
- [ ] Database initializes automatically with test data
|
||||
|
||||
### ✅ Codespaces Configuration
|
||||
- [ ] `.devcontainer/` folder exists at repository root
|
||||
- [ ] `devcontainer.json` specifies Java 17 environment
|
||||
- [ ] Docker-in-Docker feature enabled
|
||||
- [ ] `postCreateCommand` set to `docker-compose up -d`
|
||||
- [ ] Java and Docker VS Code extensions configured
|
||||
|
||||
### ✅ Integration Testing
|
||||
- [ ] Codespace launches without errors
|
||||
- [ ] Docker services start automatically
|
||||
- [ ] API accessible at `http://localhost:8888`
|
||||
- [ ] Database queries return expected test data
|
||||
- [ ] Java 17 available for Rest Assured development
|
||||
|
||||
## Risk Assessment and Mitigation
|
||||
|
||||
### Potential Issues
|
||||
1. **Port Conflicts**: Codespaces might have port conflicts
|
||||
- *Mitigation*: Use non-standard ports (8888 for API, 3307 for MySQL)
|
||||
2. **Docker Startup Timing**: API might start before database is ready
|
||||
- *Mitigation*: Implement proper health checks and startup delays
|
||||
3. **File Permissions**: Docker might have permission issues with mounted volumes
|
||||
- *Mitigation*: Set appropriate file permissions in Dockerfile
|
||||
|
||||
### Success Criteria
|
||||
- Students can open Codespace and immediately start writing tests
|
||||
- No manual configuration or setup steps required
|
||||
- All API endpoints accessible and functional
|
||||
- Database populated with realistic test data
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
## Step 3: Detailed Implementation Planning
|
||||
|
||||
Now let's ask goose to create the specific implementation prompt that will guide the execution.
|
||||
|
||||
### Creating the Implementation Prompt
|
||||
|
||||
**You:** _"This plan looks comprehensive! Can you now create a detailed implementation prompt that I can use to execute this plan? I want something specific enough that goose can follow it step-by-step without needing additional clarification."_
|
||||
|
||||
### The Implementation Prompt
|
||||
|
||||
goose will generate a detailed prompt like this:
|
||||
|
||||
<details>
|
||||
<summary>Detailed Prompt</summary>
|
||||
|
||||
```markdown
|
||||
**Task:**
|
||||
Set up my GitHub repo for GitHub Codespaces with automatic Docker startup for the local API server.
|
||||
|
||||
**Instructions:**
|
||||
|
||||
1. Create a .devcontainer folder in the root of the repo.
|
||||
2. Inside .devcontainer, create a devcontainer.json file with the following:
|
||||
- Use a Java 17 development image: "image": "mcr.microsoft.com/devcontainers/java:17"
|
||||
- Add "features": { "docker-in-docker": "latest" }
|
||||
- Set "postCreateCommand": "docker-compose up -d" to automatically start the Docker containers after the Codespace builds.
|
||||
- Optionally install VS Code extensions for Java and Docker support ("vscode-java-pack" and "vscode-docker").
|
||||
3. Create a docker-compose.yml file at the root of the repo.
|
||||
- Define the service that runs the API server.
|
||||
- Expose necessary ports (e.g., if the API runs on localhost:8888, map it accordingly).
|
||||
|
||||
Example service config:
|
||||
|
||||
`
|
||||
version: '3.8'
|
||||
services:
|
||||
api-server:
|
||||
build: ./api-server
|
||||
ports:
|
||||
- "8888:80"
|
||||
volumes:
|
||||
- ./api-server:/var/www/html
|
||||
depends_on:
|
||||
- database (if needed)
|
||||
|
||||
|
||||
- Adjust the build context and ports based on the actual API being used.
|
||||
|
||||
4. If needed, create a Dockerfile under ./api-server/ to define how the API server should be built (especially if this was originally a PHP app in MAMP).
|
||||
5. Ensure that once a Codespace launches:
|
||||
- The API server is already running
|
||||
- Users can immediately start writing and running Java tests against the API without any additional setup.
|
||||
6. Confirm that Docker is working inside the Codespace by using "docker ps" and hitting the API URL in a test after startup.
|
||||
|
||||
**Assumptions:**
|
||||
|
||||
- The API server is already included in the repo or will be added.
|
||||
- If a database is required (e.g., MySQL for the API), add it as a separate container in docker-compose.yml and configure as needed.
|
||||
|
||||
**Deliverables:**
|
||||
|
||||
- .devcontainer/devcontainer.json
|
||||
- docker-compose.yml
|
||||
- (optional) api-server/Dockerfile
|
||||
- Confirmed Codespace readiness.
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
## Step 4: Executing the Plan
|
||||
|
||||
With our detailed plan and implementation prompt ready, we can now execute the setup systematically.
|
||||
|
||||
### Starting Implementation
|
||||
|
||||
**You:** _"Perfect! Now let's implement this plan. Here's the detailed prompt we created: [paste the implementation prompt]"_
|
||||
|
||||
goose will now work through each step of the plan, creating the necessary files and configurations.
|
||||
|
||||
### Monitoring Progress
|
||||
|
||||
As goose implements the plan, you can verify each deliverable against the checklist we created:
|
||||
|
||||
1. **File Creation**: Check that each required file is created in the correct location
|
||||
2. **Configuration Accuracy**: Verify that configurations match the specifications
|
||||
3. **Integration Points**: Ensure services are properly connected and configured
|
||||
4. **Testing Readiness**: Confirm that the environment will work as intended
|
||||
|
||||
### Validation and Testing
|
||||
|
||||
Once implementation is complete, follow the validation steps from the plan:
|
||||
|
||||
```bash
|
||||
# Test Docker setup locally
|
||||
docker-compose up -d
|
||||
docker ps
|
||||
|
||||
# Verify API accessibility
|
||||
curl http://localhost:8888/api/products
|
||||
|
||||
# Test database connection
|
||||
docker exec -it mysql mysql -u user -p api_db
|
||||
```
|
||||
|
||||
## Step 5: Iterative Refinement
|
||||
|
||||
If issues arise during implementation or testing, use the plan as a reference to identify and resolve problems systematically.
|
||||
|
||||
### Common Refinements
|
||||
|
||||
- **Port Conflicts**: Adjust port mappings if conflicts occur
|
||||
- **Timing Issues**: Add health checks or startup delays
|
||||
- **Permission Problems**: Update Dockerfile with proper permissions
|
||||
- **Configuration Errors**: Verify environment variables and connection strings
|
||||
|
||||
## Best Practices for Planning with goose
|
||||
|
||||
1. Start with brainstorming. Don't jump straight to asking for a plan. Have a conversation to clarify requirements and explore options.
|
||||
2. Be specific about deliverables. Ask for concrete deliverables, file names, and validation criteria for each step.
|
||||
3. Ask goose to identify potential issues and provide mitigation strategies.
|
||||
4. Generate detailed implementation prompts that can guide execution without additional clarification.
|
||||
5. Include specific ways to verify that each step worked correctly.
|
||||
|
||||
## Advanced Planning Techniques
|
||||
|
||||
### Multi-Phase Planning
|
||||
For very complex projects, break the plan into phases and tackle them incrementally:
|
||||
|
||||
**You:** _"This plan is quite comprehensive. Can you break it into smaller phases that I can implement and test independently?"_
|
||||
|
||||
### Dependency Mapping
|
||||
Ask goose to identify dependencies between tasks:
|
||||
|
||||
**You:** _"Which of these tasks can be done in parallel, and which have dependencies on other tasks?"_
|
||||
|
||||
### Alternative Approaches
|
||||
Explore different implementation strategies:
|
||||
|
||||
**You:** _"Are there alternative approaches to this setup that might be simpler or more robust?"_
|
||||
|
||||
## Conclusion
|
||||
|
||||
goose's Plan feature transforms complex technical challenges from overwhelming problems into systematic, executable roadmaps. By following this tutorial's approach:
|
||||
|
||||
1. **Brainstorm** to clarify requirements and explore options
|
||||
2. **Plan** to break down complexity into manageable steps
|
||||
3. **Detail** to create specific implementation guidance
|
||||
4. **Execute** systematically with clear validation criteria
|
||||
5. **Refine** iteratively based on results and feedback
|
||||
|
||||
You can tackle any complex development environment setup with confidence, knowing that you have a clear path forward and specific criteria for success.
|
||||
|
||||
The key is treating goose as a planning partner, not just a code generator. Give it the full context of what you're trying to achieve, and let it help you think through the complexity before diving into implementation.
|
||||
|
||||
## Next Steps
|
||||
|
||||
- Try this approach with your own complex setup challenges
|
||||
- Experiment with different types of planning prompts
|
||||
- Share your planning successes with the [goose community](https://discord.gg/n8R5VaWDAn)
|
||||
- Explore how planning integrates with [Subagents](/docs/guides/context-engineering/subagents) for even more sophisticated workflows
|
||||
|
||||
Remember, the goal is to get the right approach, in the right order, with the right safeguards. That's what makes the difference between a quick fix and a robust, maintainable solution.
|
||||
@@ -227,11 +227,19 @@ const config: Config = {
|
||||
},
|
||||
{
|
||||
from: "/docs/guides/multi-model/creating-plans",
|
||||
to: "/docs/guides/context-engineering/creating-plans",
|
||||
to: "/docs/guides/context-engineering",
|
||||
},
|
||||
{
|
||||
from: "/docs/guides/creating-plans",
|
||||
to: "/docs/guides/context-engineering/creating-plans",
|
||||
to: "/docs/guides/context-engineering",
|
||||
},
|
||||
{
|
||||
from: "/docs/guides/context-engineering/creating-plans",
|
||||
to: "/docs/guides/context-engineering",
|
||||
},
|
||||
{
|
||||
from: "/docs/tutorials/plan-feature-devcontainer-setup",
|
||||
to: "/docs/guides/context-engineering",
|
||||
},
|
||||
{
|
||||
from: "/docs/guides/config-file",
|
||||
@@ -408,7 +416,7 @@ const config: Config = {
|
||||
},
|
||||
{
|
||||
from: "/docs/tutorials/lead-worker",
|
||||
to: "/docs/guides/context-engineering/creating-plans",
|
||||
to: "/docs/guides/context-engineering",
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
@@ -4,8 +4,6 @@ export const configLabels: Record<string, string> = {
|
||||
GOOSE_MODEL: 'Model',
|
||||
GOOSE_TEMPERATURE: 'Temperature',
|
||||
GOOSE_MODE: 'Mode',
|
||||
GOOSE_PLANNER_PROVIDER: 'Planner Provider',
|
||||
GOOSE_PLANNER_MODEL: 'Planner Model',
|
||||
GOOSE_TOOLSHIM: 'Tool Shim',
|
||||
GOOSE_TOOLSHIM_OLLAMA_MODEL: 'Tool Shim Ollama Model',
|
||||
GOOSE_CLI_MIN_PRIORITY: 'CLI Min Priority',
|
||||
|
||||
Reference in New Issue
Block a user