filedocs/BRAIN-CODEX-SYNC.md
# Brain repo + ChatGPT Codex sync policy

Goal: keep `openclaw-kompis-brain` as the single source of truth and ensure Kompis always sees Codex changes.

## 1) Commit discipline (Codex)

When using ChatGPT Codex on this repo:

- Commit small and often.
- Include a clear message with **what changed** and **why**.
- Push to `origin/main` (or agreed branch) as soon as a logical unit is done.

If Codex leaves local edits without commit, Kompis can detect it but cannot infer durable intent from uncommitted state.

## 2) Pull-before-work discipline (Kompis)

Before Kompis performs substantive repo work:

1. `git fetch --prune origin`
2. `git status --short --branch`
3. `git log --oneline -n 5`

If branch is behind or dirty, resolve first (pull/rebase/commit).

## 3) Lightweight changelog note in commit

For important updates, include one short note in commit body:

- `Context: <why this change was made>`

This keeps human intent visible without extra docs overhead.

## 4) Automated watcher

A 15-minute watcher checks:

- upstream movement (`origin/main` changed)
- local dirty state (uncommitted changes)
- ahead/behind drift

It only notifies David when there is new information or an action is needed.

## Quick Codex prompt template

Use this in Codex when working on brain repo:

"Work in `/root/.openclaw/workspace` (brain repo). Make changes, then commit with a clear subject and short body including `Context:`. Push when done. Return commit hash + changed files."