mirror of
https://github.com/agent0ai/agent-zero.git
synced 2026-12-06 18:38:51 +00:00
The profile-settings hook merged a priority-first lookup list with last-value-wins updates, allowing bundled settings to overwrite community plugins and higher user/project scopes. Merge plugin-wide settings, bundled profile, plugin profiles, user profile, project settings and project profile from low to high priority. Use the existing stable root-priority sort within each plugin layer, preserving same-root discovery order, activation scope and cached lookup lists. Add a failing-before/passing-after regression for both plugin layers, scoped overrides, fallback, malformed settings and profile/MCP inheritance. Strengthen metadata override tests with community plugins enabled and update the agent-init contract. Validation: 207 focused local tests and 18 precedence tests in the Docker framework runtime passed. Two isolated fresh-context initialization smoke checks passed in Docker. git diff --check passed.
33 lines
2.1 KiB
Markdown
33 lines
2.1 KiB
Markdown
# Agent Init Extensions DOX
|
|
|
|
## Purpose
|
|
|
|
- Own backend extensions that run when an agent context initializes.
|
|
|
|
## Ownership
|
|
|
|
- Ordered Python files own initial UI message setup and profile settings load behavior.
|
|
|
|
## Local Contracts
|
|
|
|
- Keep initialization idempotent for contexts that may be restored or reloaded.
|
|
- Preserve ordering between initial message creation and profile settings loading.
|
|
- `_15_load_profile_settings.py` merges settings from low to high priority: plugin-wide files, bundled profile, plugin profiles, user profile, project-wide file, then project profile. Each plugin layer applies bundled roots before user roots with a stable root-priority sort, preserving same-root discovery order and cached lookup lists. Global framework and `usr/settings.json` files remain excluded; malformed layers log an error and leave other layers usable. Profile and MCP configuration inherit when not explicitly overridden.
|
|
- Keep a placeholder user turn (`fw.initial_user_message.md`) ahead of the AI greeting (`fw.initial_message.md`) so `output_langchain` never pops the greeting as a leading `AIMessage`; do not remove either prompt without replacing the turn-order guarantee.
|
|
- Minify the initial AI message JSON before storage; preserve raw text as the displayed greeting when JSON parsing fails.
|
|
- `_10_initial_message.py` passes `LLMResult.non_llm()` to `hist_add_ai_response` so the Responses-API state seam runs uniformly; the sentinel carries no `response_id` and marks `mode=""`/`state="off"` so stored metadata does not claim a Responses-API turn.
|
|
- The synthetic `Hello!` user turn has no UI log. The assistant greeting is displayed as a response log with the same ID as its history message, preserving the log/history link for branching. Keep the user-first seed without duplicating the visible greeting on reload.
|
|
|
|
## Work Guidance
|
|
|
|
- Coordinate changes with profile loading, settings resolution, and startup smoke checks.
|
|
|
|
## Verification
|
|
|
|
- Smoke-test new chat/context initialization after changes.
|
|
- Run `tests/test_plugin_asset_precedence.py` and `tests/test_subagent_profiles.py` for profile-settings changes.
|
|
|
|
## Child DOX Index
|
|
|
|
No child DOX files.
|