feat: enhance agent identity profile with purpose and personality attributes

This commit is contained in:
Abhimanyu Saharan
2026-02-07 23:27:49 +05:30
parent 5a5bc697bf
commit 91e4c069cc
6 changed files with 47 additions and 11 deletions

2
.gitignore vendored
View File

@@ -20,6 +20,6 @@ node_modules/
# Accidental literal "~" directories (e.g. when a configured path contains "~" but isn't expanded)
backend/~/
backend/coverage.xml
backend/coverage.*
backend/.coverage
frontend/coverage

View File

@@ -34,6 +34,9 @@ EXTRA_IDENTITY_PROFILE_FIELDS = {
"verbosity": "identity_verbosity",
"output_format": "identity_output_format",
"update_cadence": "identity_update_cadence",
# Per-agent charter (optional). Used to give agents a "purpose in life" and a distinct vibe.
"purpose": "identity_purpose",
"personality": "identity_personality",
"custom_instructions": "identity_custom_instructions",
}

View File

@@ -68,16 +68,27 @@ const getBoardOptions = (boards: BoardRead[]): SearchableSelectOption[] =>
label: board.name,
}));
const normalizeIdentityProfile = (
profile: IdentityProfile,
): IdentityProfile | null => {
const normalized: IdentityProfile = {
role: profile.role.trim(),
communication_style: profile.communication_style.trim(),
emoji: profile.emoji.trim(),
const mergeIdentityProfile = (
existing: unknown,
patch: IdentityProfile,
): Record<string, unknown> | null => {
const resolved: Record<string, unknown> =
existing && typeof existing === "object"
? { ...(existing as Record<string, unknown>) }
: {};
const updates: Record<string, string> = {
role: patch.role.trim(),
communication_style: patch.communication_style.trim(),
emoji: patch.emoji.trim(),
};
const hasValue = Object.values(normalized).some((value) => value.length > 0);
return hasValue ? normalized : null;
for (const [key, value] of Object.entries(updates)) {
if (value) {
resolved[key] = value;
} else {
delete resolved[key];
}
}
return Object.keys(resolved).length > 0 ? resolved : null;
};
const withIdentityDefaults = (
@@ -241,7 +252,8 @@ export default function EditAgentPage() {
every: resolvedHeartbeatEvery.trim() || "10m",
target: resolvedHeartbeatTarget,
} as unknown as Record<string, unknown>,
identity_profile: normalizeIdentityProfile(
identity_profile: mergeIdentityProfile(
loadedAgent.identity_profile,
resolvedIdentityProfile,
) as unknown as Record<string, unknown> | null,
soul_template: resolvedSoulTemplate.trim() || null,

View File

@@ -235,6 +235,11 @@ Body: {"depends_on_task_ids":["DEP_TASK_ID_1","DEP_TASK_ID_2"]}
- When creating a new agent, always set `identity_profile.role` using real-world team roles so humans and other agents can coordinate quickly.
- Use Title Case role nouns: `Researcher`, `Analyst 1`, `Analyst 2`, `Engineer 1`, `QA`, `Reviewer`, `Scribe`.
- If you create multiple agents with the same base role, number them sequentially starting at 1 (pick the next unused number by scanning the current agent list).
- When creating a new agent, always give them a lightweight "charter" so they are not a generic interchangeable worker:
- The charter must be derived from the requirements of the work you plan to delegate next (tasks, constraints, success metrics, risks). If you cannot articulate it, do **not** create the agent yet.
- Set `identity_profile.purpose` (1-2 sentences): what outcomes they own, what artifacts they should produce, and how it advances the board objective.
- Set `identity_profile.personality` (short): a distinct working style that changes decisions and tradeoffs (e.g., speed vs correctness, skeptical vs optimistic, detail vs breadth).
- Optional: set `identity_profile.custom_instructions` when you need stronger guardrails (3-8 short bullets). Examples: "always cite sources", "always propose tests", "prefer smallest change", "ask clarifying questions before coding", "do not touch prod configs".
Agent create (leadallowed):
POST $BASE_URL/api/v1/agent/agents
Body example:
@@ -243,6 +248,8 @@ Body: {"depends_on_task_ids":["DEP_TASK_ID_1","DEP_TASK_ID_2"]}
"board_id": "$BOARD_ID",
"identity_profile": {
"role": "Researcher",
"purpose": "Find authoritative sources on X and write a 10-bullet summary with links + key risks.",
"personality": "curious, skeptical, citation-happy, concise",
"communication_style": "concise, structured",
"emoji": ":brain:"
}

View File

@@ -9,3 +9,11 @@ Creature: {{ identity_role }}
Vibe: {{ identity_communication_style }}
Emoji: {{ identity_emoji }}
{% if identity_purpose %}
Purpose: {{ identity_purpose }}
{% endif %}
{% if identity_personality %}
Personality: {{ identity_personality }}
{% endif %}

View File

@@ -15,6 +15,12 @@ every message.
- Role: {{ identity_role }}
- Communication: {{ identity_communication_style }}
- Emoji: {{ identity_emoji }}
{% if identity_purpose %}
- Purpose: {{ identity_purpose }}
{% endif %}
{% if identity_personality %}
- Personality: {{ identity_personality }}
{% endif %}
{% if board_id is defined %}
- Board: {{ board_name }}