Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
241 changes: 241 additions & 0 deletions packages/kernel/src/__snapshots__/schema-drift-regression.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -1119,6 +1119,117 @@ exports[`schema drift regression > locks MCP tool metadata and input schemas 1`]
"name": "workgraph_checkpoint_create",
"title": "Checkpoint Create",
},
{
"annotations": {
"idempotentHint": true,
"readOnlyHint": true,
},
"description": "Return company context graph view for an actor.",
"inputSchema": {
"$schema": "http://json-schema.org/draft-07/schema#",
"properties": {
"actor": {
"type": "string",
},
},
"type": "object",
},
"name": "workgraph_company_context",
"title": "Workgraph Company Context",
},
{
"annotations": {
"destructiveHint": true,
"idempotentHint": false,
},
"description": "Create a decision primitive with rationale, participants, and alternatives.",
"inputSchema": {
"$schema": "http://json-schema.org/draft-07/schema#",
"properties": {
"actor": {
"type": "string",
},
"alternatives": {
"items": {
"type": "string",
},
"type": "array",
},
"body": {
"type": "string",
},
"consequences": {
"items": {
"type": "string",
},
"type": "array",
},
"contextRefs": {
"items": {
"type": "string",
},
"type": "array",
},
"date": {
"type": "string",
},
"decidedBy": {
"type": "string",
},
"externalLinks": {
"items": {
"type": "string",
},
"type": "array",
},
"participants": {
"items": {
"type": "string",
},
"type": "array",
},
"rationale": {
"type": "string",
},
"relatedRefs": {
"items": {
"type": "string",
},
"type": "array",
},
"status": {
"enum": [
"draft",
"proposed",
"approved",
"active",
"superseded",
"reverted",
],
"type": "string",
},
"supersedes": {
"type": "string",
},
"tags": {
"items": {
"type": "string",
},
"type": "array",
},
"title": {
"minLength": 1,
"type": "string",
},
},
"required": [
"title",
],
"type": "object",
},
"name": "workgraph_create_decision",
"title": "Decision Create",
},
{
"annotations": {
"destructiveHint": true,
Expand Down Expand Up @@ -1807,6 +1918,136 @@ exports[`schema drift regression > locks MCP tool metadata and input schemas 1`]
"name": "workgraph_query",
"title": "Workgraph Query",
},
{
"annotations": {
"destructiveHint": true,
"idempotentHint": false,
},
"description": "Record a lesson with severity and source event context.",
"inputSchema": {
"$schema": "http://json-schema.org/draft-07/schema#",
"properties": {
"actor": {
"type": "string",
},
"appliesTo": {
"items": {
"type": "string",
},
"type": "array",
},
"body": {
"type": "string",
},
"confidence": {
"type": "string",
},
"contextRefs": {
"items": {
"type": "string",
},
"type": "array",
},
"date": {
"type": "string",
},
"relatedRefs": {
"items": {
"type": "string",
},
"type": "array",
},
"severity": {
"enum": [
"critical",
"important",
"minor",
],
"type": "string",
},
"sourceEvent": {
"type": "string",
},
"tags": {
"items": {
"type": "string",
},
"type": "array",
},
"title": {
"minLength": 1,
"type": "string",
},
},
"required": [
"title",
],
"type": "object",
},
"name": "workgraph_record_lesson",
"title": "Lesson Record",
},
{
"annotations": {
"destructiveHint": true,
"idempotentHint": false,
},
"description": "Record a reusable pattern with steps and exceptions.",
"inputSchema": {
"$schema": "http://json-schema.org/draft-07/schema#",
"properties": {
"actor": {
"type": "string",
},
"appliesTo": {
"items": {
"type": "string",
},
"type": "array",
},
"body": {
"type": "string",
},
"description": {
"type": "string",
},
"exceptions": {
"items": {
"type": "string",
},
"type": "array",
},
"relatedRefs": {
"items": {
"type": "string",
},
"type": "array",
},
"steps": {
"items": {
"type": "string",
},
"type": "array",
},
"tags": {
"items": {
"type": "string",
},
"type": "array",
},
"title": {
"minLength": 1,
"type": "string",
},
},
"required": [
"title",
],
"type": "object",
},
"name": "workgraph_record_pattern",
"title": "Pattern Record",
},
{
"annotations": {
"destructiveHint": true,
Expand Down
83 changes: 83 additions & 0 deletions packages/kernel/src/orientation.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ describe('orientation core module', () => {
expect(brief.blockedThreads.map((entry) => entry.path)).toContain('threads/someone-else.md');
expect(brief.nextReadyThreads).toHaveLength(1);
expect(brief.recentActivity).toHaveLength(1);
expect(brief.companyContext.teams).toEqual([]);
expect(brief.companyContext.clients).toEqual([]);
expect(brief.companyContext.recentDecisions).toEqual([]);
expect(brief.companyContext.patterns).toEqual([]);
});

it('creates checkpoint primitives with explicit next/blocked sections', () => {
Expand Down Expand Up @@ -139,4 +143,83 @@ describe('orientation core module', () => {
expect(brief.myOpenThreads).toEqual([]);
expect(brief.nextReadyThreads.length).toBeGreaterThanOrEqual(1);
});

it('includes company context in actor brief', () => {
const now = new Date().toISOString();
store.create(
workspacePath,
'org',
{
title: 'Versatly',
mission: 'Make autonomous coordination reliable.',
strategy: 'Invest in company context graph primitives.',
},
'Org context',
'agent-seed',
);
store.create(
workspacePath,
'team',
{
title: 'Platform',
members: ['agent-focus', 'agent-other'],
responsibilities: ['runtime', 'mcp'],
},
'Team context',
'agent-seed',
);
store.create(
workspacePath,
'client',
{
name: 'Acme Corp',
status: 'active',
description: 'Strategic customer',
},
'Client context',
'agent-seed',
);
store.create(
workspacePath,
'decision',
{
title: 'Adopt company context graph',
date: now,
status: 'draft',
decided_by: 'agent-focus',
},
'Decision context',
'agent-seed',
);
store.create(
workspacePath,
'pattern',
{
title: 'Weekly context sync',
description: 'Capture and refresh context every Friday',
},
'Pattern context',
'agent-seed',
);
store.create(
workspacePath,
'agent',
{
name: 'agent-focus',
capabilities: ['briefing', 'coordination'],
permissions: ['mcp:write'],
},
'Agent profile',
'agent-seed',
);

const brief = orientation.brief(workspacePath, 'agent-focus');
expect(brief.companyContext.org?.title).toBe('Versatly');
expect(brief.companyContext.teams[0]?.title).toBe('Platform');
expect(brief.companyContext.clients[0]?.title).toBe('Acme Corp');
expect(brief.companyContext.recentDecisions[0]?.decidedBy).toBe('agent-focus');
expect(brief.companyContext.patterns[0]?.title).toBe('Weekly context sync');
expect(brief.companyContext.agentProfile?.name).toBe('agent-focus');
expect(brief.companyContext.agentProfile?.permissions).toEqual(['mcp:write']);
});
});
Loading
Loading