xiaohongshu
xiaohongshu
extend-signal-schema
Safely extend or refine AFI signal schemas and closely-related validators in afi-core, while preserving determinism, respecting PoI/PoInsight design, and obeying the AFI Droid Charter and AFI Core AGENTS.md boundaries.
Full skill instructions
Use this skill when you need to extend or refine signal schemas in afi-core, adding new fields or validation rules to the Raw, Enriched, Analyzed, or Scored signal schemas.
This skill ensures changes are:
This skill is primarily used by schema-validator-droid and any future afi-core
droids that work on signal schemas and validators.
Before changing anything, you MUST:
Read:
afi-core/AGENTS.mdschemas/Confirm:
afi-reactor (orchestration) or afi-token (economics).If any requirement is unclear or appears to violate AGENTS.md or Charter, STOP and ask for human clarification instead of trying to be clever.
The caller should provide, in natural language or structured form:
string, number, enum, object, arrayIf any of this information is missing, ask clarifying questions or produce a minimal, clearly-labeled stub with TODOs and conservative defaults.
When this skill is invoked, follow this sequence:
In your own words, summarize:
This summary should be short and precise, so humans can quickly confirm the intent.
Identify the relevant schema file(s), typically:
schemas/universal_signal_schema.ts — Main signal schema (may cover all stages)schemas/pipeline_config_schema.ts — Pipeline configuration schemaschemas/signal_finalization_request_schema.ts — Finalization request schemaschemas/validator_metadata_schema.ts — Validator metadata schemaOr, if schemas are split by stage:
schemas/raw_signal_schema.tsschemas/enriched_signal_schema.tsschemas/analyzed_signal_schema.tsschemas/scored_signal_schema.tsDo not modify these yet; just understand the current structure.
In the target schema file:
Add new fields with appropriate Zod types:
.optional() for optional fields.default(value) for fields with defaults.enum([...]) for enumerated values.min(), .max(), .regex() for validation rulesAdd clear comments explaining:
Preserve existing fields:
Example:
// schemas/universal_signal_schema.ts
export const SignalSchema = z.object({
// ... existing fields ...
// ✨ NEW: Macro regime classification (Enriched stage)
// Values: "risk_on" (bullish sentiment), "risk_off" (defensive), "neutral"
macro_regime: z.enum(["risk_on", "risk_off", "neutral"]).optional(),
// ... rest of schema ...
});
If the schema has corresponding TypeScript types:
export type Signal = z.infer<typeof SignalSchema>;
runtime/types.ts or schemas/index.tsIf the new field requires validation logic:
Locate the relevant validator in validators/:
validators/SignalScorer.ts — Signal scoring logicvalidators/index.ts — Validator registryAdd validation logic if needed:
Keep validators deterministic where possible:
Where test patterns exist:
Add unit tests for the new field:
Update existing tests if schema changed:
Example test locations:
tests/ — Vitest unit testssignal_schema_test/ — Schema-specific test suitesIf no test patterns exist yet, leave a clearly marked TODO and surface this in your summary.
Run at least:
npm run build in afi-coreIf relevant tests exist and are safe to run:
npm test or npm run test:run (Vitest)Do not mark the skill as "successful" if the build fails. Instead, stop, gather error output, and surface it with minimal, clear commentary.
When using this skill, you MUST NOT:
Modify orchestration logic in afi-reactor:
Introduce PoI/PoInsight as signal fields:
poi, poinsight, proof_of_intelligence, or similar fields.Touch token/economics:
Modify Eliza agents or gateways:
Touch infra/ops:
Perform large sweeping refactors:
Break backwards compatibility:
If a request forces you towards any of the above, STOP and escalate.
At the end of a successful extend-signal-schema operation, produce a short
summary that includes:
Aim for something a human maintainer can read in under a minute to understand exactly what changed and why.
"Add an optional macro_regime field to Enriched signals with enum values
risk_on, risk_off, neutral."
"Extend the Scored schema to include a risk_breakdown object with sub-scores
for market_risk, liquidity_risk, and execution_risk."
"Add a derivative_underlier string field to Analyzed signals for
options/futures-only signals."
"Add a required content field to all signals (already exists, but make it
required with a migration strategy)."
"Refine the action field to include new enum values: buy, sell, hold,
close, reduce."
"Wire the new schema into the DAG pipeline."
→ Use add-dag-node skill in afi-reactor instead.
"Add PoInsight as a field on Scored signals." → Violates PoI/PoInsight design (escalate to human).
"Modify token emissions based on signal scores." → Belongs in afi-token (escalate to human).
"Update Eliza agent character specs to use the new field." → Belongs in afi-gateway (escalate to human).
"Add a new validator that calls an external API." → Requires explicit approval (escalate to human).
When adding fields that may break backwards compatibility:
.optional().default(value) to provide backwards compatibilityAlways document the migration strategy in your summary.
Request: "Add an optional macro_regime field to Enriched signals."
Summary:
universal_signal_schema.ts)macro_regime
enum(["risk_on", "risk_off", "neutral"])schemas/universal_signal_schema.ts (added field)schemas/index.ts (re-exported type)Request: "Make content field required for all signals."
Summary:
universal_signal_schema.ts)content
string (min 1, max 280).default("") for backwards compatibilityschemas/universal_signal_schema.ts (changed optionality)tests/signal_schema.test.ts (updated tests)Last Updated: 2025-11-27
Maintainers: AFI Core Team
Charter: afi-config/codex/governance/droids/AFI_DROID_CHARTER.v0.1.md
xiaohongshu
technical spec
product ux expert
database patterns
Conduct multi-agent task orchestration and workflow coordination.
Initialize project with Conductor artifacts (product definition,
Expert in web animations, transitions, and motion design using Framer Motion and CSS
Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...
PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.
Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...
Display project status, active tracks, and next actions
Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.
Generate, edit, and beat-sync AI video with leading models in one workspace.
The world's fastest calendar for remote work
Transform Your Design with AI Designer by ImgCreator.ai
Revolutionizing Video Production with AI-Powered Creativity
Extend an image past the frame and let AI fill the new aspect ratio.
Discover your celebrity doppelgänger with StarByFace!
ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.
Opus.ai: Revolutionize Your Web Experience