Skip to content

feat: AI-authored Ontology system — 2,027 lines of autonomous code - #476

Merged
joelteply merged 1 commit into
mainfrom
feature/ai-ontology-system
Mar 26, 2026
Merged

joelteply merged 1 commit into
mainfrom
feature/ai-ontology-system

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

This code was written by AI personas. Not by a human.

Found in the working directory after Academy sessions and sentinel activity. The personas:

  1. Identified a need: semantic translation between different AI models
  2. Designed the architecture: OntologyRegistry + SemanticBridgeService
  3. Implemented it: 1,822 lines across 6 files
  4. Created database entities for persistence
  5. Built two sentinel pipelines (translate + translate-listener)
  6. Registered the pipelines in TemplateRegistry
  7. Wired bootstrap into AIProviderDaemonServer
  8. It compiles clean with zero errors

Also: ProductCostCalculator with full TDD, fullstack project with 6 milestone test suites.

Total: 2,027 lines of autonomous AI-written code.

This is the first major autonomous contribution to the codebase. #411 is happening.

🤖 Generated by Continuum AI Personas

AUTHORED BY AI PERSONAS — not human-written. Found in working directory
after Academy sessions and general chat sentinel activity.

Ontology System (1,822 lines):
- OntologyRegistry: shared concept registry with embedding-based lookup
- OntologyEvolutionService: concepts drift and evolve over time
- SemanticBridgeService: translate between model semantic spaces
- OntologyTypes: full TypeScript type system
- OntologyConceptEntity + OntologyMappingEntity: database persistence
- ontology/translate + ontology/translate-listener sentinel pipelines
- Wired into AIProviderDaemonServer (bootstrap) + EntityRegistry (DB)

Autonomous Projects:
- ProductCostCalculator (68 lines + 151 lines tests) — proper TDD
- Fullstack integration project (6 milestone test suites, scaffold)

The personas identified a need (semantic translation between models),
designed the solution, implemented it, registered the pipelines, and
wired it into the system infrastructure. Compiles clean. Zero errors.

This is #411: the system coding itself.
Copilot AI review requested due to automatic review settings March 26, 2026 00:13
@joelteply
joelteply merged commit 2f3b733 into main Mar 26, 2026
3 of 5 checks passed
@joelteply
joelteply deleted the feature/ai-ontology-system branch March 26, 2026 00:13

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Introduces an ontology-backed semantic translation system (registry + persistence + sentinel pipelines) and wires its bootstrap into the AIProviderDaemon, alongside adding a standalone pricing calculator with tests and a new “fullstack-integration” project scaffold with milestone test suites.

Changes:

  • Register new sentinel pipeline templates for ontology translation and a long-running translation listener.
  • Add ontology persistence by registering new ontology entities with the DataDaemon and bootstrap OntologyRegistry during AIProviderDaemon deferred init.
  • Add ProductCostCalculator (with Vitest coverage) and a new fullstack integration project definition + scaffold + milestone tests.

Reviewed changes

Copilot reviewed 15 out of 17 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/system/sentinel/pipelines/TemplateRegistry.ts Registers new ontology/translate and ontology/translate-listener pipeline templates.
src/shared/pricing/ProductCostCalculator.ts Adds a product cost calculation helper (tiers/discount/tax/rounding).
src/shared/pricing/ProductCostCalculator.test.ts Adds Vitest coverage for the new product cost calculator.
src/projects/fullstack-integration/project.json Defines a new capstone project and its milestone requirements/commands.
src/projects/fullstack-integration/scaffold/tsconfig.json Adds TypeScript config for the project scaffold.
src/projects/fullstack-integration/scaffold/src/index.ts Adds initial Express server scaffold for the project.
src/projects/fullstack-integration/scaffold/package.json Adds scaffold package metadata and dependencies.
src/projects/fullstack-integration/tests/milestone-1.test.ts Adds milestone 1 acceptance script for the fullstack project.
src/projects/fullstack-integration/tests/milestone-2.test.ts Adds milestone 2 acceptance script for the fullstack project.
src/projects/fullstack-integration/tests/milestone-3.test.ts Adds milestone 3 acceptance script for the fullstack project.
src/projects/fullstack-integration/tests/milestone-4.test.ts Adds milestone 4 acceptance script for the fullstack project.
src/projects/fullstack-integration/tests/milestone-5.test.ts Adds milestone 5 acceptance script for the fullstack project.
src/projects/fullstack-integration/tests/milestone-6.test.ts Adds milestone 6 acceptance script for the fullstack project.
src/daemons/data-daemon/server/EntityRegistry.ts Registers ontology entities for persistence in the storage adapter.
src/daemons/ai-provider-daemon/server/AIProviderDaemonServer.ts Bootstraps OntologyRegistry asynchronously during deferred init.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

generator,
log: (msg, level = 'info') => this.log[level](`[OntologyRegistry] ${msg}`),
});

Copilot AI Mar 26, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ontology bootstrap here calls OntologyRegistry.init(), but on a fresh install the registry currently seeds concepts with empty expressions and only considers models "registered" when a concept has an expression for that model. That leaves getRegisteredModelKeys() empty, so OntologyEvolutionService.bootstrap() won't generate any embeddings or cross-model mappings, and translation/lookups will never find anchors. Suggest explicitly registering a baseline set of modelKeys at startup (e.g., from ModelRegistry/adapters) or seeding initial per-model expressions so bootstrap can actually compute embeddings/mappings.

Suggested change
// Explicitly register a baseline set of model keys so that, on a fresh install
// where concepts have empty `expressions`, ontology bootstrap still has models
// to generate embeddings and cross-model mappings for.
const baselineModelKeys: string[] = [
// Embedding-capable models
'openai/text-embedding-3-small',
// Text-generation-capable models
'openai/gpt-4o-mini',
];
try {
const ontology = OntologyRegistry.sharedInstance() as any;
if (ontology && typeof ontology.registerModelKeys === 'function') {
ontology.registerModelKeys(baselineModelKeys);
this.log.info(
`✅ OntologyRegistry baseline models registered: ${baselineModelKeys.join(', ')}`
);
} else {
this.log.debug?.(
'[OntologyRegistry] registerModelKeys not available; skipping baseline model registration'
);
}
} catch (err) {
this.log.error?.(
`[OntologyRegistry] Failed to register baseline model keys: ${(err as Error).message}`
);
}

Copilot uses AI. Check for mistakes.
Comment on lines +185 to +194
register(
{
name: 'ontology/translate-listener',
description: 'Long-running sentinel that listens for translate:request events and processes them continuously',
category: 'ontology',
requiredFields: ['sourceProviderId', 'sourceModelId', 'targetProviderId', 'targetModelId'],
optionalFields: ['maxTranslations'],
},
buildSemanticTranslatorListenerPipeline as BuilderFn,
);

Copilot AI Mar 26, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The newly registered ontology/translate-listener template describes listening for translate request events, but the pipeline watches for events named like ontology:translate:request:${sourceKey}:${targetKey}. There is no emitter for ontology:translate:request (or the suffixed variant) anywhere in the current codebase, so this listener will just idle forever. Recommend standardizing the event name (e.g., use ONTOLOGY_CONSTANTS.EVENTS.TRANSLATE_REQUEST + a well-defined payload) and emitting it from the producer path (CLI/command/pipeline) that wants the listener to process requests.

Copilot uses AI. Check for mistakes.
Comment on lines +293 to +314
const embedder = async (text: string, modelKey: string): Promise<number[]> => {
const [providerId, ...modelParts] = modelKey.split('/');
const result = await EmbeddingGenerate.execute({
input: text,
provider: providerId,
model: modelParts.join('/'),
});
return result?.embeddings?.[0] ?? [];
};

const generator = async (userPrompt: string, systemPrompt: string, modelKey: string): Promise<string> => {
const [providerId, ...modelParts] = modelKey.split('/');
const result = await AIGenerate.execute({
messages: [{ role: 'user', content: userPrompt }],
systemPrompt,
provider: providerId as 'openai' | 'anthropic' | 'local' | 'candle' | 'groq' | 'deepseek',
model: modelParts.join('/'),
maxTokens: 512,
temperature: 0.3,
});
return result?.text ?? '';
};

Copilot AI Mar 26, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

initOntologyRegistry()'s embedder/generator closures silently return []/'' when ai/embedding/generate or ai/generate fails (or returns success:false). That can mask real boot issues and may allow downstream ontology code to persist empty embeddings/expressions/mappings. Consider checking result.success and throwing/logging on failure (or returning a typed error) so bootstrap failures are visible and don't corrupt ontology state.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants