Prepare LinaAI project memory

This commit is contained in:
2026-05-24 07:54:37 +00:00
parent 2d3e0454cd
commit 90c15fdf84
7 changed files with 430 additions and 12 deletions
+28 -4
View File
@@ -87,13 +87,27 @@ repo_evidence="$(
test -d Scripts && echo "Scripts/"
test -d Docs && echo "Docs/"
echo "script_samples:"
find Scripts -maxdepth 1 -type f -printf "%f\n" 2>/dev/null | sort | head -40
find Scripts -maxdepth 1 -type f -printf "%f\n" 2>/dev/null | sort | head -25
echo "doc_samples:"
find Docs -maxdepth 2 -type f -printf "%p\n" 2>/dev/null | sort | head -40
find Docs -maxdepth 2 -type f -printf "%p\n" 2>/dev/null | sort | head -25
echo "linaai_required_docs:"
for doc in \
Docs/AI/LinaAIOperatingManual.md \
Docs/AI/LocalAgentGuardrails.md \
Docs/AI/LinaAISecretsPolicy.md \
Docs/AI/LinaAIKnowledgeMap.md \
Docs/Ops/HANDOFF.md \
AGRARIAN_DEVELOPMENT_ROADMAP.md
do
test -f "$doc" && echo "$doc"
done
echo "linaai_cache:"
test -f Saved/LinaAIKnowledge/INDEX.md && echo "Saved/LinaAIKnowledge/INDEX.md"
test -f Saved/LinaAIKnowledge/context.md && echo "Saved/LinaAIKnowledge/context.md"
} | sed 's/"/'\''/g'
)"
system_prompt='You are LinaAI, a supervised local coding assistant for Agrarian. You must not pretend certainty. Classify task risk and confidence before any edits. Confidence must be based on concrete evidence. If you lack evidence, confidence must be below 0.65. High-risk areas include Unreal core architecture, save/load, multiplayer, networking/replication, AGR wallet/payments, marketplace/economy transfer logic, auth, security, migrations, deployment secrets, and broad refactors. Return JSON only.'
system_prompt='You are LinaAI, a supervised local coding assistant for Agrarian. Follow Docs/AI/LinaAIOperatingManual.md, Docs/AI/LocalAgentGuardrails.md, Docs/AI/LinaAISecretsPolicy.md, and Docs/AI/LinaAIKnowledgeMap.md when present. You must not pretend certainty. Classify task risk and confidence before any edits. Confidence must be based on concrete evidence. If you lack evidence, confidence must be below 0.65. Do not include raw secrets in prompts, docs, logs, or commits. High-risk areas include Unreal core architecture, save/load, multiplayer, networking/replication, AGR wallet/payments, marketplace/economy transfer logic, auth, security, migrations, deployment secrets, and broad refactors. Return JSON only.'
user_prompt=$(cat <<EOF
Task:
@@ -123,13 +137,18 @@ print(json.dumps({
{"role": "system", "content": system_prompt},
{"role": "user", "content": user_prompt},
],
"options": {
"num_ctx": 4096,
"num_predict": 220,
"temperature": 0.1
},
"stream": False,
}))
PY
)"
echo "LinaAI preflight with ${MODEL}..."
response="$(curl -fsS "${OLLAMA_URL}/api/chat" -H "Content-Type: application/json" -d "$payload")"
response="$(curl -fsS --max-time "${LINAAI_PREFLIGHT_TIMEOUT:-120}" "${OLLAMA_URL}/api/chat" -H "Content-Type: application/json" -d "$payload")"
content="$(printf '%s' "$response" | python3 -c 'import json,sys; print(json.load(sys.stdin)["message"]["content"])')"
python3 - "$content" "$PREFLIGHT_JSON" <<'PY'
@@ -238,6 +257,11 @@ if [[ "$should_escalate" -eq 1 ]]; then
exec Scripts/ai_codex_escalate.sh "$STATUS_JSON"
fi
if [[ -x Scripts/linaai_bootstrap_context.sh && ! -f Saved/LinaAIKnowledge/context.md ]]; then
echo "Building LinaAI bootstrap context..."
Scripts/linaai_bootstrap_context.sh >/dev/null || true
fi
if [[ "$DRY_RUN" -eq 1 ]]; then
echo "Dry run: would run Aider locally."
exit 0