feat(profile): support scoped custom prompts - #1541
Conversation
| updated = await self.policies.update(connection, policy) | ||
| refs = tuple(item.ref for item in evidence) | ||
| parents = () if current is None else (current.as_ref(),) | ||
| artifacts = (*parents, *_profile_prompt_refs()) |
There was a problem hiding this comment.
[P2] Reserve evidence capacity for the selected Prompt
With a Custom profile.generate Prompt and activation_mode="review_required", a full window exceeds the 32-reference candidate limit: 32 Sources + Prompt for the first Profile, or 31 Sources + previous Profile + Prompt for an update. I reproduced both on SQLite: each flush raises ValidationError: Candidate evidence must not exceed 32 references, and retrying invokes the generator again without advancing the cursor. Please reserve capacity for the Prompt when computing the Source window and cover both cases.
| key="profile.generate", | ||
| definition_version="powercontext.prompt.profile.generate.v1", | ||
| input_type=ProfileGenerationInput, | ||
| output_type=ProfileGenerationOutput, |
There was a problem hiding this comment.
[P2] Validate Profile demonstration content against the runtime contract
ProfileGenerationOutput accepts blank strings, and validate_demonstration() has no Profile check. I verified that {"content":" "} is accepted by both demonstration generation and Prompt creation, while the built-in Profile generator returning the same output causes flush to raise InvalidInferenceOutputError during Markdown validation. Please apply the Profile Markdown validation to non-null demonstration outputs and use content=null for no-op examples.
Which issue or RFC does this PR close?
Related to #1468, #1473, and #1536.
Rationale for this change
Scope-owned Prompt management supports Memory, Experience, Skill, and Handoff operations, but Profile generation still uses fixed server instructions. This leaves Profile as the remaining generated artifact that cannot apply scoped guidance or record the exact Prompt revision used for generation.
What changes are included in this PR?
profile.generateas a Prompt key with the existing Profile input/output contract and unchanged Auto instructions.ProfileGeneratorcomponents as unsupported for managed Prompt customization, matching the existing component capability model.Are there any user-facing changes?
Yes. Clients can create or replace a Scope-owned Prompt artifact with
prompt_key=profile.generate. The Prompt affects future Profile processing windows only; saving it does not reprocess historical Sources. This is additive and requires no data migration.How was this change tested?
make checkmake contract-test(47 passed)AI usage statement
Implemented and reviewed with OpenAI Codex (GPT-5), including code analysis, test generation, and validation.