fix: feat(20g): migrate all remaining agents to .profile + remove ops repo journal dirs (#90)

This commit is contained in:
Agent 2026-04-01 13:11:08 +00:00
parent 0455040d02
commit bd0b4cd9bf
3 changed files with 23 additions and 12 deletions

View file

@ -926,6 +926,8 @@ ${ops_name}/
└── RESOURCES.md # accounts, tokens (refs), infra inventory └── RESOURCES.md # accounts, tokens (refs), infra inventory
\`\`\` \`\`\`
> **Note:** Journal directories (journal/planner/ and journal/supervisor/) have been removed from the ops repo. Agent journals are now stored in each agent's .profile repo on Forgejo.
## Branch protection ## Branch protection
- \`main\`: 2 reviewers required for vault items - \`main\`: 2 reviewers required for vault items

View file

@ -350,6 +350,17 @@ ${lessons_content}"
return 0 return 0
} }
# formula_prepare_profile_context
# Pre-session: loads lessons from .profile repo and sets LESSONS_CONTEXT for prompt injection.
# Single shared function to avoid duplicate boilerplate across agent scripts.
# Requires: AGENT_IDENTITY, FORGE_TOKEN, FORGE_URL (via profile_load_lessons).
# Exports: LESSONS_CONTEXT (set by profile_load_lessons).
# Returns 0 on success, 1 if agent has no .profile repo (silent no-op).
formula_prepare_profile_context() {
profile_load_lessons || true
LESSONS_INJECTION="${LESSONS_CONTEXT:-}"
}
# profile_write_journal ISSUE_NUM ISSUE_TITLE OUTCOME [FILES_CHANGED] # profile_write_journal ISSUE_NUM ISSUE_TITLE OUTCOME [FILES_CHANGED]
# Post-session: writes a reflection journal entry after work completes. # Post-session: writes a reflection journal entry after work completes.
# Returns 0 on success, 1 on failure. # Returns 0 on success, 1 on failure.

View file

@ -45,12 +45,6 @@ WORKTREE="/tmp/${PROJECT_NAME}-planner-run"
log() { echo "[$(date -u +%Y-%m-%dT%H:%M:%S)Z] $*" >> "$LOG_FILE"; } log() { echo "[$(date -u +%Y-%m-%dT%H:%M:%S)Z] $*" >> "$LOG_FILE"; }
# Ensure AGENT_IDENTITY is set for profile functions
if [ -z "${AGENT_IDENTITY:-}" ] && [ -n "${FORGE_PLANNER_TOKEN:-}" ]; then
AGENT_IDENTITY=$(curl -sf -H "Authorization: token ${FORGE_PLANNER_TOKEN}" \
"${FORGE_URL:-http://localhost:3000}/api/v1/user" 2>/dev/null | jq -r '.login // empty' 2>/dev/null || true)
fi
# ── Guards ──────────────────────────────────────────────────────────────── # ── Guards ────────────────────────────────────────────────────────────────
check_active planner check_active planner
acquire_cron_lock "/tmp/planner-run.lock" acquire_cron_lock "/tmp/planner-run.lock"
@ -58,8 +52,14 @@ check_memory 2000
log "--- Planner run start ---" log "--- Planner run start ---"
# ── Resolve agent identity for .profile repo ────────────────────────────
if [ -z "${AGENT_IDENTITY:-}" ] && [ -n "${FORGE_PLANNER_TOKEN:-}" ]; then
AGENT_IDENTITY=$(curl -sf -H "Authorization: token ${FORGE_PLANNER_TOKEN}" \
"${FORGE_URL:-http://localhost:3000}/api/v1/user" 2>/dev/null | jq -r '.login // empty' 2>/dev/null || true)
fi
# ── Load formula + context ─────────────────────────────────────────────── # ── Load formula + context ───────────────────────────────────────────────
load_formula "$FACTORY_ROOT/formulas/run-planner.toml" load_formula_or_profile "planner" "$FACTORY_ROOT/formulas/run-planner.toml" || exit 1
build_context_block VISION.md AGENTS.md ops:RESOURCES.md ops:prerequisites.md build_context_block VISION.md AGENTS.md ops:RESOURCES.md ops:prerequisites.md
# ── Build structural analysis graph ────────────────────────────────────── # ── Build structural analysis graph ──────────────────────────────────────
@ -78,9 +78,8 @@ $(cat "$MEMORY_FILE")
" "
fi fi
# ── Load lessons from .profile repo (pre-session) ──────────────────────── # ── Prepare .profile context (lessons injection) ─────────────────────────
profile_load_lessons || true formula_prepare_profile_context
LESSONS_INJECTION="${LESSONS_CONTEXT:-}"
# ── Read scratch file (compaction survival) ─────────────────────────────── # ── Read scratch file (compaction survival) ───────────────────────────────
SCRATCH_CONTEXT=$(read_scratch_context "$SCRATCH_FILE") SCRATCH_CONTEXT=$(read_scratch_context "$SCRATCH_FILE")
@ -96,8 +95,7 @@ build_sdk_prompt_footer "
PROMPT="You are the strategic planner for ${FORGE_REPO}. Work through the formula below. PROMPT="You are the strategic planner for ${FORGE_REPO}. Work through the formula below.
## Project context ## Project context
${CONTEXT_BLOCK}${MEMORY_BLOCK} ${CONTEXT_BLOCK}${MEMORY_BLOCK}${LESSONS_INJECTION:+## Lessons learned
${LESSONS_INJECTION:+## Lessons learned
${LESSONS_INJECTION} ${LESSONS_INJECTION}
} }