-
Notifications
You must be signed in to change notification settings - Fork 352
feat: add engine.bare frontmatter field to suppress automatic context loading #25661
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
8839e6d
86c5e6d
76f64f1
21d5061
a74a17d
69d6b96
6f64905
e376357
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -162,6 +162,13 @@ func (e *ClaudeEngine) GetExecutionSteps(workflowData *WorkflowData, logFile str | |
| // This format is compatible with the log parser which expects either JSON array or JSONL | ||
| claudeArgs = append(claudeArgs, "--output-format", "stream-json") | ||
|
|
||
| // Add --bare when bare mode is enabled to suppress automatic loading of memory | ||
| // files (CLAUDE.md, ~/.claude/) and other context injections. | ||
| if workflowData.EngineConfig != nil && workflowData.EngineConfig.Bare { | ||
| claudeLog.Print("Bare mode enabled: adding --bare") | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice clean implementation! The nil-guard |
||
| claudeArgs = append(claudeArgs, "--bare") | ||
| } | ||
|
|
||
| // Add custom args from engine configuration before the prompt | ||
| if workflowData.EngineConfig != nil && len(workflowData.EngineConfig.Args) > 0 { | ||
| claudeArgs = append(claudeArgs, workflowData.EngineConfig.Args...) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -190,6 +190,14 @@ func (e *CodexEngine) GetExecutionSteps(workflowData *WorkflowData, logFile stri | |
| customArgsParam += customArgsParamSb.String() | ||
| } | ||
|
|
||
| // Build bare mode parameter: --no-system-prompt is a global Codex flag placed before the | ||
| // "exec" subcommand to suppress loading of the default system prompt/instructions. | ||
| bareGlobalParam := "" | ||
| if workflowData.EngineConfig != nil && workflowData.EngineConfig.Bare { | ||
| codexEngineLog.Print("Bare mode enabled: adding --no-system-prompt") | ||
| bareGlobalParam = "--no-system-prompt " | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
| } | ||
|
|
||
| // Build the Codex command | ||
| // Determine which command to use | ||
| var commandName string | ||
|
|
@@ -201,8 +209,8 @@ func (e *CodexEngine) GetExecutionSteps(workflowData *WorkflowData, logFile stri | |
| commandName = "codex" | ||
| } | ||
|
|
||
| codexCommand := fmt.Sprintf("%s %sexec%s%s%s%s\"$INSTRUCTION\"", | ||
| commandName, modelParam, webSearchParam, webFetchParam, fullAutoParam, customArgsParam) | ||
| codexCommand := fmt.Sprintf("%s %s%sexec%s%s%s%s\"$INSTRUCTION\"", | ||
| commandName, modelParam, bareGlobalParam, webSearchParam, webFetchParam, fullAutoParam, customArgsParam) | ||
|
|
||
| // Build the full command with agent file handling and AWF wrapping if enabled | ||
| var command string | ||
|
|
@@ -268,13 +276,13 @@ touch %s | |
| AGENT_CONTENT="$(awk 'BEGIN{skip=1} /^---$/{if(skip){skip=0;next}else{skip=1;next}} !skip' %s)" | ||
| INSTRUCTION="$(printf "%%s\n\n%%s" "$AGENT_CONTENT" "$(cat "$GH_AW_PROMPT")")" | ||
| mkdir -p "$CODEX_HOME/logs" | ||
| %s %sexec%s%s%s%s"$INSTRUCTION" 2>&1 | tee %s`, AgentStepSummaryPath, agentPath, commandName, modelParam, webSearchParam, webFetchParam, fullAutoParam, customArgsParam, logFile) | ||
| %s 2>&1 | tee %s`, AgentStepSummaryPath, agentPath, codexCommand, logFile) | ||
| } else { | ||
| command = fmt.Sprintf(`set -o pipefail | ||
| touch %s | ||
| INSTRUCTION="$(cat "$GH_AW_PROMPT")" | ||
| mkdir -p "$CODEX_HOME/logs" | ||
| %s %sexec%s%s%s%s"$INSTRUCTION" 2>&1 | tee %s`, AgentStepSummaryPath, commandName, modelParam, webSearchParam, webFetchParam, fullAutoParam, customArgsParam, logFile) | ||
| %s 2>&1 | tee %s`, AgentStepSummaryPath, codexCommand, logFile) | ||
| } | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -27,6 +27,7 @@ type EngineConfig struct { | |
| Args []string | ||
| Agent string // Agent identifier for copilot --agent flag (copilot engine only) | ||
| APITarget string // Custom API endpoint hostname (e.g., "api.acme.ghe.com" or "api.enterprise.githubcopilot.com") | ||
| Bare bool // When true, disables automatic loading of context/instructions (copilot: --no-custom-instructions, claude: --bare, codex: --no-system-prompt, gemini: GEMINI_SYSTEM_MD=/dev/null) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The inline comment on |
||
| // TokenWeights provides custom model cost data for effective token computation. | ||
| // When set, overrides or extends the built-in model_multipliers.json values. | ||
| TokenWeights *types.TokenWeights | ||
|
|
@@ -288,6 +289,14 @@ func (c *Compiler) ExtractEngineConfig(frontmatter map[string]any) (string, *Eng | |
| } | ||
| } | ||
|
|
||
| // Extract optional 'bare' field (disable automatic context/instruction loading) | ||
| if bare, hasBare := engineObj["bare"]; hasBare { | ||
| if bareBool, ok := bare.(bool); ok { | ||
| config.Bare = bareBool | ||
| engineLog.Printf("Extracted bare mode: %v", config.Bare) | ||
| } | ||
| } | ||
|
Comment on lines
+300
to
+306
|
||
|
|
||
| // Extract optional 'token-weights' field (custom model cost data) | ||
| if tokenWeightsRaw, hasTokenWeights := engineObj["token-weights"]; hasTokenWeights { | ||
| if tw := parseEngineTokenWeights(tokenWeightsRaw); tw != nil { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Schema adds
engine.bareonly to the{ id: ... }engine config shape. Inline engine definitions (engine: { runtime: { ... } }) still cannot specifybare, and the compiler currently ignoresbarefor inline definitions as well. If bare mode should be supported uniformly, addbareto the inline-engine schema branch too (and ensure the compiler parses it). Otherwise, consider explicitly documenting this limitation in the schema description to avoid confusing users.