Skip to content

Init: preserve existing config, prompt for cadence, write supporting docs#342

Merged
kai-linux merged 1 commit intomainfrom
feat/init-config-safety-cadence-docs
Apr 24, 2026
Merged

Init: preserve existing config, prompt for cadence, write supporting docs#342
kai-linux merged 1 commit intomainfrom
feat/init-config-safety-cadence-docs

Conversation

@kai-linux
Copy link
Copy Markdown
Owner

Summary

Three ergonomic fixes for `bin/agentos init` so rerunning it for a new project doesn't silently clobber the operator's existing configuration and so a newly onboarded repo starts life with the right documents in place.

1. Preserve existing `config.yaml` scalars

The previous merge path unconditionally overwrote `telegram_bot_token`, `telegram_chat_id`, and the repo's own `github_projects[name]` / `github_repos[name]` entries every time init ran. These now `setdefault` — first-run values land as before, re-runs keep what the operator already set. Added a confirmation prompt at the write step so the operator sees what's about to happen and can abort to hand-edit if preferred.

2. New "Step 5/8 — Tuning cadence and thresholds"

Walks the operator through the knobs that used to be hardcoded in `build_config`:

  • `sprint_cadence_days`
  • `groomer_cadence_days`
  • `max_parallel_workers`
  • `max_runtime_minutes`
  • `plan_size`
  • `default_max_attempts`
  • `dependency_watcher.cadence_days`

Defaults come from the existing config when present, so pressing enter preserves what's already set. Only records an override when the chosen value differs from the existing-config default, to keep the config minimal.

3. Extended charter output: VISION + STRATEGY + PLANNING_PRINCIPLES

The architect prompt now also produces `VISION.md`, `STRATEGY.md`, and `PLANNING_PRINCIPLES.md` alongside `NORTH_STAR.md`. The commit step writes only the docs actually returned — older payloads that only have `north_star_md` still commit cleanly, so a resumed init from before this change doesn't break.

Test plan

  • `pytest tests/test_init_*` — 30 passed (12 new)
  • `pytest tests/` excluding the big slow suites — 529 passed

Follow-up discovered while writing this

The `_ensure_repo_initialized` flow in github_scaffold (merged yesterday in #335) already adds `.agent_result.md` to `.gitignore`. The vision/strategy/principles docs land in the initial charter commit, so they benefit from the same ignore-the-handoff-contract protection automatically.

…docs

Three ergonomic fixes for `bin/agentos init` so rerunning it for a new
project doesn't silently clobber the operator's existing configuration
and so a newly onboarded repo actually starts life with the right
documents in place.

1. Preserve existing config.yaml scalars. The previous merge path
   unconditionally overwrote `telegram_bot_token`, `telegram_chat_id`,
   and the repo's own `github_projects[name]` / `github_repos[name]`
   entries every time init ran. Those now `setdefault` — first-run
   values land as before, re-runs keep what the operator already has.
   Added a "this will merge into existing config" confirmation at the
   write step so the operator sees what's about to happen and can
   abort to hand-edit if they prefer.

2. New "Step 5/8 — Tuning cadence and thresholds" phase prompts the
   operator for the cadence knobs that used to be hardcoded:
   sprint_cadence_days, groomer_cadence_days, max_parallel_workers,
   max_runtime_minutes, plan_size, default_max_attempts,
   dependency_watcher.cadence_days. Defaults come from the existing
   config when present, so pressing enter on each keeps what's
   already there. Only records an override when the new value
   differs, to keep the config minimal.

3. Extend the architect prompt to also produce VISION.md,
   STRATEGY.md, and PLANNING_PRINCIPLES.md alongside NORTH_STAR.md.
   The commit step writes only the docs the architect actually
   returned — older payloads that only have north_star_md still
   commit cleanly, so a resumed init from before this change
   doesn't fail.
@kai-linux kai-linux merged commit 9116647 into main Apr 24, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant