kitchen: README + MISSIONS/engine-c keep-drop notes

This commit is contained in:
Hernâni Marques 2026-09-17 21:48:48 +02:00
parent 1d351918da
commit 575d7d29b8
No known key found for this signature in database
130 changed files with 9817 additions and 1 deletions

View file

@ -0,0 +1,31 @@
# openkknd2 launchers (per host / tool)
Each script prepares **`$OPENKKND2_ROOT`** under `~/src/` (unique folder per tool/host) and prints the agent brief for autonomous work.
| Script | Host | Tool | Default workdir |
|--------|------|------|-----------------|
| `scripts/start-mac-osaurus.sh` | Mac | Osaurus agent | `~/src/openkknd2-osaurus` |
| `scripts/start-mac-jan.sh` | Mac | Jan | `~/src/openkknd2-jan` |
| `scripts/start-amanita-coder.sh` | amanita | agent-coder / OpenClaw | `~/src/openkknd2-am-coder` |
| `scripts/start-amanita-pics.sh` | amanita | am-agent-pics + code | `~/src/openkknd2-am-pics` |
| `scripts/start-amanita-vids.sh` | amanita | am-agent-vids + cinematics | `~/src/openkknd2-am-vids` |
| `scripts/common.sh` | all | shared bootstrap | — |
## Env
```bash
export LLM_CONFIGS=~/src/llm-configs # this repo
export OPENKKND2_ROOT=~/src/openkknd2-<tool>
```
## Agent must
1. Work only under `$OPENKKND2_ROOT` (plus read-only knowledge).
2. Stay autonomous → playable game + headless tests.
3. **No copyrighted KKnD assets.**
4. Cinematics: original pipeline (instruction 1819).
## Instructions
- [../instructions/18-openkknd2-autonomous-rebuild.md](../instructions/18-openkknd2-autonomous-rebuild.md)
- [../instructions/19-openkknd2-cinematics.md](../instructions/19-openkknd2-cinematics.md)

View file

@ -0,0 +1,108 @@
#!/usr/bin/env bash
# Bootstrap OPENKKND2_ROOT and seed legal stubs.
set -euo pipefail
openkknd2_bootstrap() {
local root="${1:?root}"
mkdir -p "$root"/{src,include,assets/cinematics,docs,scripts,tests}
if [[ ! -f "$root/LICENSE" ]]; then
cat >"$root/LICENSE" <<'L'
MIT License
Copyright (c) 2026 openkknd2 contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
L
fi
if [[ ! -f "$root/THIRD_PARTY.md" ]]; then
cat >"$root/THIRD_PARTY.md" <<'T'
# Third-party
Only permissive / original materials. **Forbidden:** KKnD/KKnD2/Xtreme proprietary assets.
| Component | License | Note |
|-----------|---------|------|
| (none yet) | | |
T
fi
if [[ ! -f "$root/docs/LORE.md" ]]; then
cat >"$root/docs/LORE.md" <<'O'
# Lore (original)
Working names (change freely; **do not** use commercial KKnD faction trademarks as official names):
- Faction A: **Ashcoat Compact** (scrap tech, discipline)
- Faction B: **Bloomed** (mutated ecology, swarm tactics)
Tone: dry wasteland humor, not a copy of any commercial script.
O
fi
if [[ ! -f "$root/AGENT_LOG.md" ]]; then
echo "# Agent log" >"$root/AGENT_LOG.md"
echo "" >>"$root/AGENT_LOG.md"
echo "Started $(date -u +%Y-%m-%dT%H:%M:%SZ)" >>"$root/AGENT_LOG.md"
fi
if [[ ! -f "$root/scripts/ci-headless.sh" ]]; then
cat >"$root/scripts/ci-headless.sh" <<'C'
#!/usr/bin/env bash
set -euo pipefail
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
cd "$ROOT"
# Placeholder until engine exists: legal tree check
rg -i 'kknd2|krossfire|\.iso\b' --glob '!**/.git/**' . && {
echo "FORBIDDEN string found" >&2
exit 2
} || true
echo "ci-headless: stub OK (extend when binary exists)"
C
chmod +x "$root/scripts/ci-headless.sh"
fi
if [[ ! -f "$root/README.md" ]]; then
cat >"$root/README.md" <<R
# openkknd2 (worktree)
Autonomous agent worktree. **Not** a KKnD remake.
\`\`\`bash
export OPENKKND2_ROOT=$root
# build/test TBD by agent
./scripts/ci-headless.sh
\`\`\`
Instructions: \`\$LLM_CONFIGS/instructions/18-openkknd2-autonomous-rebuild.md\`
R
fi
export OPENKKND2_ROOT="$root"
echo "OPENKKND2_ROOT=$OPENKKND2_ROOT"
}
openkknd2_print_brief() {
local tool="$1"
cat <<EOF
=== openkknd2 agent brief ($tool) ===
OPENKKND2_ROOT=$OPENKKND2_ROOT
LLM_CONFIGS=${LLM_CONFIGS:-$HOME/src/llm-configs}
Knowledge: \$HOME/OsaurusKnowledge/openkknd2/ (or mirror in llm-configs)
Read and follow:
\$LLM_CONFIGS/instructions/18-openkknd2-autonomous-rebuild.md
\$LLM_CONFIGS/instructions/19-openkknd2-cinematics.md
Rules: original/permissive assets only; autonomous; headless tests after each chunk.
Cinematics params: MEDIA_WIDTH/HEIGHT/FPS/SECONDS via llm-configs/media/
EOF
}

View file

@ -0,0 +1,240 @@
#!/usr/bin/env bash
# rotate-models-amanita.sh — try coding models one-by-one until openkknd2 progresses.
#
# Run ON amanita (or: ssh amanita bash -s < this-script).
# Uses short Zusatzprompt; fresh OpenClaw session per model; progress gate on tree.
#
# OPENKKND2_ROOT=~/src/openkknd2-am-coder \
# LLM_CONFIGS=~/src/llm-configs \
# bash rotate-models-amanita.sh
#
set -euo pipefail
export PATH="${HOME}/.local/bin:/usr/local/bin:/usr/bin:/bin:${PATH}"
export LLM_CONFIGS="${LLM_CONFIGS:-$HOME/src/llm-configs}"
ROOT="${OPENKKND2_ROOT:-$HOME/src/openkknd2-am-coder}"
LOG_DIR="${ROTATE_LOG_DIR:-$ROOT/rotate-logs}"
PROMPT_FILE="${PROMPT_FILE:-$LLM_CONFIGS/prompts/openkknd2-continue-short.md}"
MAX_TURNS="${ROTATE_MAX_TURNS:-12}"
AGENT="${AGENT_CODER:-$HOME/agent-coder}"
# Single-flight load policy: never run next model until previous fully stopped;
# unload other ollama models between slots; no parallel pulls.
SINGLE_FLIGHT="${ROTATE_SINGLE_FLIGHT:-1}"
mkdir -p "$LOG_DIR"
cd "$ROOT"
unload_other_ollama() {
# Keep the model we are about to use; stop everything else loaded.
local keep="${1:-}"
command -v ollama >/dev/null 2>&1 || return 0
local name
while read -r name _; do
[[ -z "${name:-}" || "$name" == "NAME" ]] && continue
if [[ -n "$keep" && "$name" == *"$keep"* ]]; then
continue
fi
ollama stop "$name" 2>/dev/null || true
done < <(ollama ps 2>/dev/null | awk 'NR>1 {print $1}' || true)
# Never start pulls mid-rotate
pkill -TERM -f "ollama pull" 2>/dev/null || true
}
# agent-coder model flags in order (skip already-failed qwen first if SKIP_QWEN=1)
# Devstral = agentic coding specialist (Mistral + All Hands)
MODELS_DEFAULT=(
"--devstral"
"--coder"
"--qwen314"
"--qwen14"
"--deepseek"
"--qwen38"
"--hermes"
)
# Optional: also try qwen3.6 last (heavy, already flaked once)
if [[ "${INCLUDE_QWEN36:-0}" == "1" ]]; then
MODELS_DEFAULT+=("--qwen36")
fi
# shellcheck disable=SC2206
MODELS=( ${ROTATE_MODELS:-${MODELS_DEFAULT[*]}} )
ts() { date -u +%Y-%m-%dT%H:%M:%SZ; }
stamp() { date -u +%Y%m%dT%H%M%SZ; }
code_stats() {
python3 - <<'PY'
import os
from pathlib import Path
root = Path(os.environ.get("ROOT", "."))
skip = {".git", "build", "node_modules", "rotate-logs"}
exts = {".c", ".h", ".cpp", ".hpp", ".cc", ".py", ".sh", ".cmake"}
files, lines = 0, 0
names = []
for p in root.rglob("*"):
if any(part in skip for part in p.parts):
continue
if not p.is_file():
continue
if p.suffix.lower() not in exts and p.name != "CMakeLists.txt":
continue
try:
text = p.read_text(encoding="utf-8", errors="ignore")
except Exception:
continue
n = text.count("\n") + (1 if text and not text.endswith("\n") else 0)
files += 1
lines += n
names.append(str(p.relative_to(root)))
has_build = any("ok_build" in n for n in names)
has_ai = any("ok_ai" in n for n in names)
print(f"{files} {lines} {int(has_build)} {int(has_ai)}")
PY
}
ci_green() {
if [[ -x "$ROOT/scripts/ci-headless.sh" ]]; then
(cd "$ROOT" && ./scripts/ci-headless.sh) >/tmp/ok2-rotate-ci.log 2>&1 && return 0
return 1
fi
return 1
}
progressed() {
# args: before "files lines has_build has_ai"
local b_files b_lines b_b b_a a_files a_lines a_b a_a
read -r b_files b_lines b_b b_a <<<"$1"
read -r a_files a_lines a_b a_a <<<"$2"
# success if meaningful code growth OR new build/ai modules + still green
if (( a_lines >= b_lines + 40 )); then return 0; fi
if (( a_files > b_files && a_lines > b_lines )); then return 0; fi
if (( a_b > b_b || a_a > b_a )) && (( a_lines > b_lines )); then return 0; fi
return 1
}
if [[ ! -x "$AGENT" ]]; then
echo "error: agent-coder missing at $AGENT" >&2
exit 1
fi
if [[ ! -f "$PROMPT_FILE" ]]; then
echo "error: prompt missing: $PROMPT_FILE" >&2
exit 1
fi
PROMPT="$(cat "$PROMPT_FILE")"
SUMMARY="$LOG_DIR/rotate-$(stamp).md"
{
echo "# openkknd2 model rotation"
echo
echo "- started: $(ts)"
echo "- workdir: \`$ROOT\`"
echo "- prompt: \`$PROMPT_FILE\`"
echo "- max_turns: $MAX_TURNS"
echo
echo "| # | flag | session | before lines | after lines | progress | ci |"
echo "|---|------|---------|--------------|-------------|----------|----|"
} >"$SUMMARY"
echo "=== model rotation start $(ts) ===" | tee -a "$LOG_DIR/rotate.out"
echo "ROOT=$ROOT models=${MODELS[*]}" | tee -a "$LOG_DIR/rotate.out"
i=0
for flag in "${MODELS[@]}"; do
i=$((i + 1))
sess="ok2-rot${i}-$(echo "$flag" | tr -cd 'A-Za-z0-9')"
runlog="$LOG_DIR/run-${i}$(echo "$flag" | tr -cd 'A-Za-z0-9').log"
echo | tee -a "$LOG_DIR/rotate.out"
echo ">>> [$i/${#MODELS[@]}] model flag=$flag session=$sess $(ts)" | tee -a "$LOG_DIR/rotate.out"
export ROOT
before="$(code_stats)"
read -r bf bl bb ba <<<"$before"
echo " before: files=$bf lines=$bl build=$bb ai=$ba" | tee -a "$LOG_DIR/rotate.out"
# Stop any leftover registered agent for this tree (best effort)
am-task stop all --reason "rotate: switch to $flag" 2>/dev/null || true
sleep 2
if [[ "$SINGLE_FLIGHT" == "1" ]]; then
# Map flag → ollama name fragment for keep-list
keep_frag=""
case "$flag" in
--devstral) keep_frag="devstral" ;;
--coder) keep_frag="qwen3-coder" ;;
--qwen36) keep_frag="qwen3.6" ;;
--qwen314) keep_frag="qwen3:14b" ;;
--qwen38) keep_frag="qwen3:8b" ;;
--qwen14) keep_frag="qwen2.5-coder:14b" ;;
--deepseek) keep_frag="deepseek" ;;
--hermes) keep_frag="hermes" ;;
esac
echo " single-flight: unload other ollama models (keep~$keep_frag)" | tee -a "$LOG_DIR/rotate.out"
unload_other_ollama "$keep_frag"
sleep 1
fi
set +e
(
cd "$ROOT"
# shellcheck disable=SC2086
"$AGENT" $flag -s "$sess" -A --max-turns "$MAX_TURNS" --detach "$PROMPT"
) >"$runlog" 2>&1
launch_ec=$?
set -e
echo " launch_ec=$launch_ec log=$runlog" | tee -a "$LOG_DIR/rotate.out"
# Wait until no active am-task (or timeout)
deadline=$(( $(date +%s) + ${ROTATE_WAIT_SECS:-3600} ))
while (( $(date +%s) < deadline )); do
active="$(ls "$HOME/.am-agent-tasks/active"/*.json 2>/dev/null | wc -l | tr -d ' ')"
if [[ "${active:-0}" == "0" ]]; then
break
fi
# still running
sleep 15
done
# if still active after wait — stop and move on
if ls "$HOME/.am-agent-tasks/active"/*.json >/dev/null 2>&1; then
echo " timeout waiting — stop all" | tee -a "$LOG_DIR/rotate.out"
am-task stop all --reason "rotate: wait timeout after $flag" 2>/dev/null || true
sleep 2
fi
export ROOT
after="$(code_stats)"
read -r af al ab aa <<<"$after"
echo " after: files=$af lines=$al build=$ab ai=$aa" | tee -a "$LOG_DIR/rotate.out"
ci="fail"
if ci_green; then ci="green"; fi
echo " ci=$ci" | tee -a "$LOG_DIR/rotate.out"
prog="no"
if progressed "$before" "$after"; then prog="YES"; fi
echo "| $i | \`$flag\` | \`$sess\` | $bl | $al | $prog | $ci |" >>"$SUMMARY"
if [[ "$prog" == "YES" ]]; then
{
echo
echo "## WINNER"
echo
echo "- flag: \`$flag\`"
echo "- session: \`$sess\`"
echo "- lines: $bl$al"
echo "- ci: $ci"
echo "- finished: $(ts)"
} >>"$SUMMARY"
echo "=== PROGRESS with $flag — stop rotation ===" | tee -a "$LOG_DIR/rotate.out"
echo "SUMMARY=$SUMMARY"
exit 0
fi
echo " no meaningful progress — next model" | tee -a "$LOG_DIR/rotate.out"
done
{
echo
echo "## RESULT"
echo
echo "No model produced meaningful code growth within max_turns=$MAX_TURNS."
echo "- finished: $(ts)"
} >>"$SUMMARY"
echo "=== rotation exhausted without progress ===" | tee -a "$LOG_DIR/rotate.out"
echo "SUMMARY=$SUMMARY"
exit 1

View file

@ -0,0 +1,13 @@
#!/usr/bin/env bash
set -euo pipefail
export LLM_CONFIGS="${LLM_CONFIGS:-$HOME/src/llm-configs}"
# shellcheck source=common.sh
source "$LLM_CONFIGS/openkknd2/scripts/common.sh"
openkknd2_bootstrap "${OPENKKND2_ROOT:-$HOME/src/openkknd2-am-coder}"
openkknd2_print_brief "amanita-coder"
if [[ -x "$HOME/agent-coder" ]]; then
echo "Launch example:"
echo " cd \"\$OPENKKND2_ROOT\" && ~/agent-coder --coder \"Read \$LLM_CONFIGS/instructions/18-openkknd2-autonomous-rebuild.md and continue autonomous openkknd2 build with headless tests.\""
else
echo "agent-coder not found at ~/agent-coder — start OpenClaw manually in \$OPENKKND2_ROOT"
fi

View file

@ -0,0 +1,9 @@
#!/usr/bin/env bash
set -euo pipefail
export LLM_CONFIGS="${LLM_CONFIGS:-$HOME/src/llm-configs}"
# shellcheck source=common.sh
source "$LLM_CONFIGS/openkknd2/scripts/common.sh"
openkknd2_bootstrap "${OPENKKND2_ROOT:-$HOME/src/openkknd2-am-pics}"
openkknd2_print_brief "amanita-pics"
echo "Concept art path: use $LLM_CONFIGS/media/am-agent-pics with original prompts only."
echo " $LLM_CONFIGS/media/am-agent-pics --width 512 --height 512 --steps 2 --prompt 'original scrap-tech scout silhouette, wasteland, no logos'"

View file

@ -0,0 +1,11 @@
#!/usr/bin/env bash
set -euo pipefail
export LLM_CONFIGS="${LLM_CONFIGS:-$HOME/src/llm-configs}"
# shellcheck source=common.sh
source "$LLM_CONFIGS/openkknd2/scripts/common.sh"
openkknd2_bootstrap "${OPENKKND2_ROOT:-$HOME/src/openkknd2-am-vids}"
openkknd2_print_brief "amanita-vids"
echo "Cinematics: instruction 19 + knowledge 03-cinematics."
echo " export MEDIA_SECONDS=2 MEDIA_FPS=10 MEDIA_WIDTH=640 MEDIA_HEIGHT=360"
echo " $LLM_CONFIGS/media/am-agent-vids --make-still --seconds 2 --fps 10"
echo "Move results into \$OPENKKND2_ROOT/assets/cinematics/"

View file

@ -0,0 +1,8 @@
#!/usr/bin/env bash
set -euo pipefail
export LLM_CONFIGS="${LLM_CONFIGS:-$HOME/src/llm-configs}"
# shellcheck source=common.sh
source "$LLM_CONFIGS/openkknd2/scripts/common.sh"
openkknd2_bootstrap "${OPENKKND2_ROOT:-$HOME/src/openkknd2-jan}"
openkknd2_print_brief "mac-jan"
echo "Next: Jan Ops/Coder thread → paste brief; enable tools; stay under \$OPENKKND2_ROOT"

View file

@ -0,0 +1,8 @@
#!/usr/bin/env bash
set -euo pipefail
export LLM_CONFIGS="${LLM_CONFIGS:-$HOME/src/llm-configs}"
# shellcheck source=common.sh
source "$LLM_CONFIGS/openkknd2/scripts/common.sh"
openkknd2_bootstrap "${OPENKKND2_ROOT:-$HOME/src/openkknd2-osaurus}"
openkknd2_print_brief "mac-osaurus"
echo "Next: open Osaurus Coder → paste brief + instruction 18; work only under \$OPENKKND2_ROOT"