feat: persist agent's soul_template to prevent overwriting on reprovision
This commit is contained in:
@@ -17,6 +17,7 @@ from app.api import tasks as tasks_api
|
|||||||
from app.api.deps import ActorContext, get_board_or_404, get_task_or_404
|
from app.api.deps import ActorContext, get_board_or_404, get_task_or_404
|
||||||
from app.core.agent_auth import AgentAuthContext, get_agent_auth_context
|
from app.core.agent_auth import AgentAuthContext, get_agent_auth_context
|
||||||
from app.core.config import settings
|
from app.core.config import settings
|
||||||
|
from app.core.time import utcnow
|
||||||
from app.db.pagination import paginate
|
from app.db.pagination import paginate
|
||||||
from app.db.session import get_session
|
from app.db.session import get_session
|
||||||
from app.integrations.openclaw_gateway import GatewayConfig as GatewayClientConfig
|
from app.integrations.openclaw_gateway import GatewayConfig as GatewayClientConfig
|
||||||
@@ -572,6 +573,12 @@ async def update_agent_soul(
|
|||||||
status_code=status.HTTP_422_UNPROCESSABLE_ENTITY,
|
status_code=status.HTTP_422_UNPROCESSABLE_ENTITY,
|
||||||
detail="content is required",
|
detail="content is required",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Persist the SOUL in the DB so future reprovision/update doesn't overwrite it.
|
||||||
|
target.soul_template = content
|
||||||
|
target.updated_at = utcnow()
|
||||||
|
session.add(target)
|
||||||
|
await session.commit()
|
||||||
try:
|
try:
|
||||||
await openclaw_call(
|
await openclaw_call(
|
||||||
"agents.files.set",
|
"agents.files.set",
|
||||||
|
|||||||
@@ -321,6 +321,7 @@ Tools:
|
|||||||
- Update an agent's SOUL.md (lead-only):
|
- Update an agent's SOUL.md (lead-only):
|
||||||
PUT $BASE_URL/api/v1/agent/boards/$BOARD_ID/agents/<AGENT_ID>/soul
|
PUT $BASE_URL/api/v1/agent/boards/$BOARD_ID/agents/<AGENT_ID>/soul
|
||||||
Body: {"content":"<new SOUL.md>","source_url":"<optional>","reason":"<optional>"}
|
Body: {"content":"<new SOUL.md>","source_url":"<optional>","reason":"<optional>"}
|
||||||
|
Notes: this persists as the agent's `soul_template` so future reprovision won't overwrite it.
|
||||||
|
|
||||||
## Memory Maintenance (every 2-3 days)
|
## Memory Maintenance (every 2-3 days)
|
||||||
Lightweight consolidation (modeled on human "sleep consolidation"):
|
Lightweight consolidation (modeled on human "sleep consolidation"):
|
||||||
|
|||||||
Reference in New Issue
Block a user