Skip to content

Commit 119b6b0

Browse files
jkyberneeesclaude
andauthored
refactor(config): remove github_repo_directory and github_repo_url (#8)
Drop the github_repo_directory and github_repo_url configuration attributes and all their plumbing. These were largely informational: github_repo_url only ever appeared in prompt text (system prompt and Telegram Quick Facts), and github_repo_directory added prompt text plus a Telegram-only os.Chdir into the project tree. Removed across the precedence chain: - Config file keys, ODEK_GITHUB_REPO_* env vars, and --github-repo-dir / --github-repo-url CLI flags (internal/config/loader.go, cmd/odek/main.go) - CLIFlags, Config, and ResolvedConfig struct fields plus expandEnv/merge handling - System prompt repo context block (buildSystemPrompt) - REPL repo hint, Telegram Quick Facts source line, Telegram chdir, and the /new repo line - Config template entry and help text - Associated test references Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent fef1deb commit 119b6b0

5 files changed

Lines changed: 2 additions & 109 deletions

File tree

cmd/odek/main.go

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -92,21 +92,12 @@ One wrong name wastes an entire iteration. Be precise.
9292
// 1. resolved.System (explicit --system / ODEK_SYSTEM / config)
9393
// 2. ~/.odek/IDENTITY.md (swappable identity file)
9494
// 3. defaultSystem (compiled-in fallback)
95-
//
96-
// After selecting the base, it appends repo directory/URL context.
9795
func buildSystemPrompt(resolved config.ResolvedConfig) string {
9896
base := resolved.System
9997
if base == "" {
10098
base = loadIdentityFile()
10199
}
102100

103-
if resolved.GithubRepoDirectory != "" {
104-
base += fmt.Sprintf("\n\nRepository directory: %s\nThis is the local clone of the project repository.", resolved.GithubRepoDirectory)
105-
}
106-
if resolved.GithubRepoUrl != "" {
107-
base += fmt.Sprintf("\nRepository URL: %s\nThis is the upstream GitHub repository.\n", resolved.GithubRepoUrl)
108-
}
109-
110101
return base
111102
}
112103

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

179-
// Repo context flags
180-
GithubRepoDirectory string // --github-repo-dir
181-
GithubRepoUrl string // --github-repo-url
182-
183170
Deliver *bool // nil = not set; true = deliver result to default channel
184171
}
185172

@@ -293,18 +280,6 @@ func parseRunFlags(args []string) (runFlags, error) {
293280
}
294281
f.SandboxUser = args[i+1]
295282
i += 2
296-
case "--github-repo-dir":
297-
if i+1 >= len(args) {
298-
return f, fmt.Errorf("--github-repo-dir requires a value")
299-
}
300-
f.GithubRepoDirectory = args[i+1]
301-
i += 2
302-
case "--github-repo-url":
303-
if i+1 >= len(args) {
304-
return f, fmt.Errorf("--github-repo-url requires a value")
305-
}
306-
f.GithubRepoUrl = args[i+1]
307-
i += 2
308283
case "--ctx", "-c":
309284
if i+1 >= len(args) {
310285
return f, fmt.Errorf("--ctx requires a value")
@@ -582,7 +557,6 @@ const defaultConfigTemplate = `{
582557
"no_color": false,
583558
"no_agents": false,
584559
"system": "",
585-
"github_repo_directory": "",
586560
"sandbox_image": "",
587561
"sandbox_network": "none",
588562
"sandbox_readonly": false,
@@ -708,7 +682,6 @@ func initConfig(args []string) error {
708682
fmt.Println(" no_color Disable colored output (true/false)")
709683
fmt.Println(" no_agents Skip AGENTS.md (true/false)")
710684
fmt.Println(" system System prompt override")
711-
fmt.Println(" github_repo_directory Local clone path of the project repo")
712685
fmt.Println(" sandbox_image Docker image (alpine:latest if empty)")
713686
fmt.Println(" sandbox_network Network mode (none | bridge | host)")
714687
fmt.Println(" sandbox_readonly Mount working directory read-only")
@@ -765,9 +738,6 @@ func run(args []string) error {
765738
SandboxMemory: f.SandboxMemory,
766739
SandboxCPUs: f.SandboxCPUs,
767740
SandboxUser: f.SandboxUser,
768-
769-
GithubRepoDirectory: f.GithubRepoDirectory,
770-
GithubRepoUrl: f.GithubRepoUrl,
771741
})
772742

773743
// Resolve @references and --ctx file attachments in the task

cmd/odek/main_test.go

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2018,8 +2018,7 @@ func TestBuildSystemPrompt_ExplicitSystemWins(t *testing.T) {
20182018
os.WriteFile(filepath.Join(homeDir, ".odek", "IDENTITY.md"), []byte("# Identity from file"), 0644)
20192019

20202020
resolved := config.ResolvedConfig{
2021-
System: "Explicit system override",
2022-
GithubRepoDirectory: "/tmp/repo",
2021+
System: "Explicit system override",
20232022
}
20242023

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

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

20532049
func TestBuildSystemPrompt_FallsBackToDefault(t *testing.T) {
20542050
_ = setupTestHome(t)
2055-
resolved := config.ResolvedConfig{
2056-
GithubRepoUrl: "https://github.com/test/repo",
2057-
}
2051+
resolved := config.ResolvedConfig{}
20582052

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

20682059
// ── System prompt optimization validation tests ──────────────────────────

cmd/odek/repl.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,6 @@ func replCmd(args []string) error {
6262
SandboxUser: f.SandboxUser,
6363
})
6464
systemMessage := buildSystemPrompt(resolved)
65-
if resolved.GithubRepoDirectory != "" {
66-
systemMessage += " You can read and modify files here. When asked to update your own code, this is where the source lives."
67-
}
6865

6966
// session resume
7067
if sess != nil && sess.Sandbox && !resolved.Sandbox {

cmd/odek/telegram.go

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -171,9 +171,6 @@ func telegramCmd(args []string) error {
171171
systemMessage += "\n\nQuick Facts (use these, do NOT search):\n"
172172
systemMessage += "- odek website: https://odek.21no.de\n"
173173
systemMessage += "- Built by: 21no.de (https://21no.de)\n"
174-
if resolved.GithubRepoUrl != "" {
175-
systemMessage += fmt.Sprintf("- Source code: %s\n", resolved.GithubRepoUrl)
176-
}
177174
systemMessage += "- Binary name: odek\n"
178175
systemMessage += "- Language: Go, minimal dependencies, ~11 MB binary\n"
179176
systemMessage += "\n"
@@ -197,13 +194,6 @@ func telegramCmd(args []string) error {
197194
systemMessage += "- Without file_glob, every readable file in the subtree is opened and scanned.\n"
198195
systemMessage += "- For multi-pattern searches, use multi_grep (parallel walk, less overhead).\n"
199196
systemMessage += "\n"
200-
// Set working directory to the configured repo directory.
201-
// This ensures tools like search_files scan the project, not /root.
202-
if resolved.GithubRepoDirectory != "" {
203-
if err := os.Chdir(resolved.GithubRepoDirectory); err != nil {
204-
fmt.Fprintf(os.Stderr, "odek telegram: warning: failed to chdir to %s: %v\n", resolved.GithubRepoDirectory, err)
205-
}
206-
}
207197

208198
// Telegram-specific system prompt additions
209199
//
@@ -282,10 +272,6 @@ func telegramCmd(args []string) error {
282272
if resolved.Skills.Verbose {
283273
b.WriteString("• Skills verbose: on\n")
284274
}
285-
if resolved.GithubRepoDirectory != "" {
286-
repo := filepath.Base(resolved.GithubRepoDirectory)
287-
fmt.Fprintf(&b, "• Repo: `%s`\n", repo)
288-
}
289275
b.WriteString("\n_Send a message to begin._")
290276
return b.String(), nil
291277
}

internal/config/loader.go

Lines changed: 0 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,6 @@ type CLIFlags struct {
6565
SandboxUser string
6666
SandboxReadonly *bool // nil = not set
6767

68-
// GithubRepoDirectory is the path to the local clone of the project repo.
69-
GithubRepoDirectory string
70-
71-
// GithubRepoUrl is the HTTPS URL of the project's GitHub repository.
72-
GithubRepoUrl string
73-
7468
// InteractionMode controls how tool-call progress is surfaced.
7569
// "engaging" (default) = emoji-rich narration, progress message edited.
7670
// "enhance" = per-tool narrated messages appended, progress header kept.
@@ -173,18 +167,6 @@ type FileConfig struct {
173167
// Schedules configures the native in-process task scheduler.
174168
Schedules *SchedulesConfig `json:"schedules,omitempty"`
175169

176-
// GithubRepoDirectory is the path to the local clone of the project
177-
// repository. Injected into the system prompt so the agent knows
178-
// where source code lives and can self-correct.
179-
// Config: github_repo_directory, ODEK_GITHUB_REPO_DIRECTORY.
180-
GithubRepoDirectory string `json:"github_repo_directory,omitempty"`
181-
182-
// GithubRepoUrl is the HTTPS URL of the project's GitHub repository.
183-
// Injected into the system prompt so the agent can reference the
184-
// upstream repo for PRs, issues, and documentation links.
185-
// Config: github_repo_url, ODEK_GITHUB_REPO_URL.
186-
GithubRepoUrl string `json:"github_repo_url,omitempty"`
187-
188170
// InteractionMode controls how the agent communicates tool/progress updates.
189171
// "engaging" (default) = emoji-rich narration, progress message edited.
190172
// "enhance" = per-tool narrated messages, progress header kept.
@@ -294,13 +276,6 @@ type ResolvedConfig struct {
294276
// Default: enabled=true, max_concurrent=2, timezone="UTC", catchup=false.
295277
Schedules ScheduleConfig
296278

297-
// GithubRepoDirectory is the path to the local clone of the project
298-
// repository. Injected into the system prompt.
299-
GithubRepoDirectory string
300-
301-
// GithubRepoUrl is the HTTPS URL of the project's GitHub repository.
302-
GithubRepoUrl string
303-
304279
// InteractionMode is the resolved interaction style.
305280
// Values: "engaging" (default), "enhance", "verbose", or "off".
306281
// "engaging" (default), "enhance", or "verbose".
@@ -372,8 +347,6 @@ func loadFile(path string) FileConfig {
372347
cfg.SandboxMemory = expandEnv(cfg.SandboxMemory)
373348
cfg.SandboxCPUs = expandEnv(cfg.SandboxCPUs)
374349
cfg.SandboxUser = expandEnv(cfg.SandboxUser)
375-
cfg.GithubRepoDirectory = expandEnv(cfg.GithubRepoDirectory)
376-
cfg.GithubRepoUrl = expandEnv(cfg.GithubRepoUrl)
377350
return cfg
378351
}
379352

@@ -576,16 +549,6 @@ func LoadConfig(cli CLIFlags) ResolvedConfig {
576549
cfg.MaxConcurrency = v
577550
}
578551

579-
// Github repo directory env var
580-
if v := envString("GITHUB_REPO_DIRECTORY"); v != "" {
581-
cfg.GithubRepoDirectory = v
582-
}
583-
584-
// Github repo URL env var
585-
if v := envString("GITHUB_REPO_URL"); v != "" {
586-
cfg.GithubRepoUrl = v
587-
}
588-
589552
// InteractionMode env var
590553
if v := envString("INTERACTION_MODE"); v != "" {
591554
cfg.InteractionMode = v
@@ -673,12 +636,6 @@ func LoadConfig(cli CLIFlags) ResolvedConfig {
673636
if cli.SandboxUser != "" {
674637
cfg.SandboxUser = cli.SandboxUser
675638
}
676-
if cli.GithubRepoDirectory != "" {
677-
cfg.GithubRepoDirectory = cli.GithubRepoDirectory
678-
}
679-
if cli.GithubRepoUrl != "" {
680-
cfg.GithubRepoUrl = cli.GithubRepoUrl
681-
}
682639
if cli.InteractionMode != "" {
683640
cfg.InteractionMode = cli.InteractionMode
684641
}
@@ -706,8 +663,6 @@ func LoadConfig(cli CLIFlags) ResolvedConfig {
706663
Telegram: resolveTelegram(cfg.Telegram),
707664
Transcription: resolveTranscription(cfg.Transcription),
708665
Schedules: resolveSchedules(cfg.Schedules),
709-
GithubRepoDirectory: cfg.GithubRepoDirectory,
710-
GithubRepoUrl: cfg.GithubRepoUrl,
711666
InteractionMode: ifZero(cfg.InteractionMode, "engaging"),
712667
ToolProgress: ifZero(cfg.ToolProgress, "all"),
713668
}
@@ -1103,12 +1058,6 @@ func overlayFile(base, override FileConfig) FileConfig {
11031058
base.MCPServers[k] = v
11041059
}
11051060
}
1106-
if override.GithubRepoDirectory != "" {
1107-
base.GithubRepoDirectory = override.GithubRepoDirectory
1108-
}
1109-
if override.GithubRepoUrl != "" {
1110-
base.GithubRepoUrl = override.GithubRepoUrl
1111-
}
11121061
if override.InteractionMode != "" {
11131062
base.InteractionMode = override.InteractionMode
11141063
}

0 commit comments

Comments
 (0)