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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 0 additions & 30 deletions cmd/odek/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,21 +92,12 @@ One wrong name wastes an entire iteration. Be precise.
// 1. resolved.System (explicit --system / ODEK_SYSTEM / config)
// 2. ~/.odek/IDENTITY.md (swappable identity file)
// 3. defaultSystem (compiled-in fallback)
//
// After selecting the base, it appends repo directory/URL context.
func buildSystemPrompt(resolved config.ResolvedConfig) string {
base := resolved.System
if base == "" {
base = loadIdentityFile()
}

if resolved.GithubRepoDirectory != "" {
base += fmt.Sprintf("\n\nRepository directory: %s\nThis is the local clone of the project repository.", resolved.GithubRepoDirectory)
}
if resolved.GithubRepoUrl != "" {
base += fmt.Sprintf("\nRepository URL: %s\nThis is the upstream GitHub repository.\n", resolved.GithubRepoUrl)
}

return base
}

Expand Down Expand Up @@ -176,10 +167,6 @@ type runFlags struct {
SandboxUser string // Container user (e.g. "1000:1000")
SandboxReadonly *bool // nil = not set; true = read-only mount

// Repo context flags
GithubRepoDirectory string // --github-repo-dir
GithubRepoUrl string // --github-repo-url

Deliver *bool // nil = not set; true = deliver result to default channel
}

Expand Down Expand Up @@ -293,18 +280,6 @@ func parseRunFlags(args []string) (runFlags, error) {
}
f.SandboxUser = args[i+1]
i += 2
case "--github-repo-dir":
if i+1 >= len(args) {
return f, fmt.Errorf("--github-repo-dir requires a value")
}
f.GithubRepoDirectory = args[i+1]
i += 2
case "--github-repo-url":
if i+1 >= len(args) {
return f, fmt.Errorf("--github-repo-url requires a value")
}
f.GithubRepoUrl = args[i+1]
i += 2
case "--ctx", "-c":
if i+1 >= len(args) {
return f, fmt.Errorf("--ctx requires a value")
Expand Down Expand Up @@ -582,7 +557,6 @@ const defaultConfigTemplate = `{
"no_color": false,
"no_agents": false,
"system": "",
"github_repo_directory": "",
"sandbox_image": "",
"sandbox_network": "none",
"sandbox_readonly": false,
Expand Down Expand Up @@ -708,7 +682,6 @@ func initConfig(args []string) error {
fmt.Println(" no_color Disable colored output (true/false)")
fmt.Println(" no_agents Skip AGENTS.md (true/false)")
fmt.Println(" system System prompt override")
fmt.Println(" github_repo_directory Local clone path of the project repo")
fmt.Println(" sandbox_image Docker image (alpine:latest if empty)")
fmt.Println(" sandbox_network Network mode (none | bridge | host)")
fmt.Println(" sandbox_readonly Mount working directory read-only")
Expand Down Expand Up @@ -765,9 +738,6 @@ func run(args []string) error {
SandboxMemory: f.SandboxMemory,
SandboxCPUs: f.SandboxCPUs,
SandboxUser: f.SandboxUser,

GithubRepoDirectory: f.GithubRepoDirectory,
GithubRepoUrl: f.GithubRepoUrl,
})

// Resolve @references and --ctx file attachments in the task
Expand Down
13 changes: 2 additions & 11 deletions cmd/odek/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2018,8 +2018,7 @@ func TestBuildSystemPrompt_ExplicitSystemWins(t *testing.T) {
os.WriteFile(filepath.Join(homeDir, ".odek", "IDENTITY.md"), []byte("# Identity from file"), 0644)

resolved := config.ResolvedConfig{
System: "Explicit system override",
GithubRepoDirectory: "/tmp/repo",
System: "Explicit system override",
}

got := buildSystemPrompt(resolved)
Expand All @@ -2029,9 +2028,6 @@ func TestBuildSystemPrompt_ExplicitSystemWins(t *testing.T) {
if strings.Contains(got, "Identity from file") {
t.Error("IDENTITY.md content should NOT appear when explicit System is set")
}
if !strings.Contains(got, "/tmp/repo") {
t.Error("repo directory should appear in prompt")
}
}

func TestBuildSystemPrompt_FallsBackToIdentity(t *testing.T) {
Expand All @@ -2052,17 +2048,12 @@ func TestBuildSystemPrompt_FallsBackToIdentity(t *testing.T) {

func TestBuildSystemPrompt_FallsBackToDefault(t *testing.T) {
_ = setupTestHome(t)
resolved := config.ResolvedConfig{
GithubRepoUrl: "https://github.com/test/repo",
}
resolved := config.ResolvedConfig{}

got := buildSystemPrompt(resolved)
if !strings.Contains(got, "You are odek") {
t.Error("expected defaultSystem identity when no override or IDENTITY.md")
}
if !strings.Contains(got, "https://github.com/test/repo") {
t.Error("repo URL should appear in prompt")
}
}

// ── System prompt optimization validation tests ──────────────────────────
Expand Down
3 changes: 0 additions & 3 deletions cmd/odek/repl.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,6 @@ func replCmd(args []string) error {
SandboxUser: f.SandboxUser,
})
systemMessage := buildSystemPrompt(resolved)
if resolved.GithubRepoDirectory != "" {
systemMessage += " You can read and modify files here. When asked to update your own code, this is where the source lives."
}

// session resume
if sess != nil && sess.Sandbox && !resolved.Sandbox {
Expand Down
14 changes: 0 additions & 14 deletions cmd/odek/telegram.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,6 @@ func telegramCmd(args []string) error {
systemMessage += "\n\nQuick Facts (use these, do NOT search):\n"
systemMessage += "- odek website: https://odek.21no.de\n"
systemMessage += "- Built by: 21no.de (https://21no.de)\n"
if resolved.GithubRepoUrl != "" {
systemMessage += fmt.Sprintf("- Source code: %s\n", resolved.GithubRepoUrl)
}
systemMessage += "- Binary name: odek\n"
systemMessage += "- Language: Go, minimal dependencies, ~11 MB binary\n"
systemMessage += "\n"
Expand All @@ -197,13 +194,6 @@ func telegramCmd(args []string) error {
systemMessage += "- Without file_glob, every readable file in the subtree is opened and scanned.\n"
systemMessage += "- For multi-pattern searches, use multi_grep (parallel walk, less overhead).\n"
systemMessage += "\n"
// Set working directory to the configured repo directory.
// This ensures tools like search_files scan the project, not /root.
if resolved.GithubRepoDirectory != "" {
if err := os.Chdir(resolved.GithubRepoDirectory); err != nil {
fmt.Fprintf(os.Stderr, "odek telegram: warning: failed to chdir to %s: %v\n", resolved.GithubRepoDirectory, err)
}
}

// Telegram-specific system prompt additions
//
Expand Down Expand Up @@ -282,10 +272,6 @@ func telegramCmd(args []string) error {
if resolved.Skills.Verbose {
b.WriteString("• Skills verbose: on\n")
}
if resolved.GithubRepoDirectory != "" {
repo := filepath.Base(resolved.GithubRepoDirectory)
fmt.Fprintf(&b, "• Repo: `%s`\n", repo)
}
b.WriteString("\n_Send a message to begin._")
return b.String(), nil
}
Expand Down
51 changes: 0 additions & 51 deletions internal/config/loader.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,6 @@ type CLIFlags struct {
SandboxUser string
SandboxReadonly *bool // nil = not set

// GithubRepoDirectory is the path to the local clone of the project repo.
GithubRepoDirectory string

// GithubRepoUrl is the HTTPS URL of the project's GitHub repository.
GithubRepoUrl string

// InteractionMode controls how tool-call progress is surfaced.
// "engaging" (default) = emoji-rich narration, progress message edited.
// "enhance" = per-tool narrated messages appended, progress header kept.
Expand Down Expand Up @@ -173,18 +167,6 @@ type FileConfig struct {
// Schedules configures the native in-process task scheduler.
Schedules *SchedulesConfig `json:"schedules,omitempty"`

// GithubRepoDirectory is the path to the local clone of the project
// repository. Injected into the system prompt so the agent knows
// where source code lives and can self-correct.
// Config: github_repo_directory, ODEK_GITHUB_REPO_DIRECTORY.
GithubRepoDirectory string `json:"github_repo_directory,omitempty"`

// GithubRepoUrl is the HTTPS URL of the project's GitHub repository.
// Injected into the system prompt so the agent can reference the
// upstream repo for PRs, issues, and documentation links.
// Config: github_repo_url, ODEK_GITHUB_REPO_URL.
GithubRepoUrl string `json:"github_repo_url,omitempty"`

// InteractionMode controls how the agent communicates tool/progress updates.
// "engaging" (default) = emoji-rich narration, progress message edited.
// "enhance" = per-tool narrated messages, progress header kept.
Expand Down Expand Up @@ -294,13 +276,6 @@ type ResolvedConfig struct {
// Default: enabled=true, max_concurrent=2, timezone="UTC", catchup=false.
Schedules ScheduleConfig

// GithubRepoDirectory is the path to the local clone of the project
// repository. Injected into the system prompt.
GithubRepoDirectory string

// GithubRepoUrl is the HTTPS URL of the project's GitHub repository.
GithubRepoUrl string

// InteractionMode is the resolved interaction style.
// Values: "engaging" (default), "enhance", "verbose", or "off".
// "engaging" (default), "enhance", or "verbose".
Expand Down Expand Up @@ -372,8 +347,6 @@ func loadFile(path string) FileConfig {
cfg.SandboxMemory = expandEnv(cfg.SandboxMemory)
cfg.SandboxCPUs = expandEnv(cfg.SandboxCPUs)
cfg.SandboxUser = expandEnv(cfg.SandboxUser)
cfg.GithubRepoDirectory = expandEnv(cfg.GithubRepoDirectory)
cfg.GithubRepoUrl = expandEnv(cfg.GithubRepoUrl)
return cfg
}

Expand Down Expand Up @@ -576,16 +549,6 @@ func LoadConfig(cli CLIFlags) ResolvedConfig {
cfg.MaxConcurrency = v
}

// Github repo directory env var
if v := envString("GITHUB_REPO_DIRECTORY"); v != "" {
cfg.GithubRepoDirectory = v
}

// Github repo URL env var
if v := envString("GITHUB_REPO_URL"); v != "" {
cfg.GithubRepoUrl = v
}

// InteractionMode env var
if v := envString("INTERACTION_MODE"); v != "" {
cfg.InteractionMode = v
Expand Down Expand Up @@ -673,12 +636,6 @@ func LoadConfig(cli CLIFlags) ResolvedConfig {
if cli.SandboxUser != "" {
cfg.SandboxUser = cli.SandboxUser
}
if cli.GithubRepoDirectory != "" {
cfg.GithubRepoDirectory = cli.GithubRepoDirectory
}
if cli.GithubRepoUrl != "" {
cfg.GithubRepoUrl = cli.GithubRepoUrl
}
if cli.InteractionMode != "" {
cfg.InteractionMode = cli.InteractionMode
}
Expand Down Expand Up @@ -706,8 +663,6 @@ func LoadConfig(cli CLIFlags) ResolvedConfig {
Telegram: resolveTelegram(cfg.Telegram),
Transcription: resolveTranscription(cfg.Transcription),
Schedules: resolveSchedules(cfg.Schedules),
GithubRepoDirectory: cfg.GithubRepoDirectory,
GithubRepoUrl: cfg.GithubRepoUrl,
InteractionMode: ifZero(cfg.InteractionMode, "engaging"),
ToolProgress: ifZero(cfg.ToolProgress, "all"),
}
Expand Down Expand Up @@ -1103,12 +1058,6 @@ func overlayFile(base, override FileConfig) FileConfig {
base.MCPServers[k] = v
}
}
if override.GithubRepoDirectory != "" {
base.GithubRepoDirectory = override.GithubRepoDirectory
}
if override.GithubRepoUrl != "" {
base.GithubRepoUrl = override.GithubRepoUrl
}
if override.InteractionMode != "" {
base.InteractionMode = override.InteractionMode
}
Expand Down
Loading