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
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,12 @@ cd cortex && npm install --omit=dev
| `retrievalBudget` | `number` | `2000` | Max token budget for retrieved memories |
| `maxInjectionChars` | `number` | `8000` | Max characters injected into agent context |
| `retrievalMode` | `string` | `fast` | Retrieval mode: `auto`, `fast`, or `thorough` |
| `companyBrainContextMode` | `string` | `off` | Opt-in Company Brain context injection: `off` or `auto` |
| `companyBrainContextAccountId` | `string` | — | Stable account ID for account-scoped Company Brain context |
| `companyBrainContextSearch` | `string` | — | Account search text used when no account ID is configured |
| `companyBrainContextFactsLimit` | `number` | `25` | Max account facts requested for Company Brain context |
| `companyBrainContextEventsLimit` | `number` | `10` | Max action-readiness events requested for Company Brain context |
| `companyBrainContextMaxChars` | `number` | `6000` | Max characters in the Company Brain context block |

## Tools

Expand Down Expand Up @@ -104,6 +110,13 @@ Company Brain tools are explicit and account-scoped. They call Cortex
pagination, and `insufficient_evidence`. They do not inject generic always-on
Company Brain context and they do not write to shared plugin storage.

For customer/account workspaces, `companyBrainContextMode: "auto"` enables a
separate `<company-brain-context>` block. The block is distinct from
`<relevant-memories>`, resolves the account through the Company Brain account
path, preserves cited evidence and action-readiness metadata, and marks
approval-gated items as read-only operator-review candidates rather than
executable actions.

## How It Works

Cortex operates two invisible loops around every agent conversation:
Expand Down
2 changes: 2 additions & 0 deletions dist/__tests__/company-brain-context-format.test.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export {};
//# sourceMappingURL=company-brain-context-format.test.d.ts.map
1 change: 1 addition & 0 deletions dist/__tests__/company-brain-context-format.test.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

126 changes: 126 additions & 0 deletions dist/__tests__/company-brain-context-format.test.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions dist/__tests__/company-brain-context-format.test.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

40 changes: 40 additions & 0 deletions dist/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ interface EvaMemoryConfig {
injectionCriticalThreshold: number;
injectionTechnicalThreshold: number;
injectionPersonalThreshold: number;
companyBrainContextMode: "off" | "auto";
companyBrainContextAccountId: string;
companyBrainContextSearch: string;
companyBrainContextFactsLimit: number;
companyBrainContextEventsLimit: number;
companyBrainContextMaxChars: number;
}
interface RetrievedItem {
source: string;
Expand All @@ -67,13 +73,22 @@ interface RetrievedItem {
provenance?: string;
}
type CompanyBrainToolResult = Record<string, unknown>;
interface CompanyBrainContextPayload {
account?: Record<string, unknown> | null;
brief?: CompanyBrainToolResult | null;
actionReadiness?: CompanyBrainToolResult | null;
resolution?: Record<string, unknown> | null;
}
interface ProcessedItem {
item: RetrievedItem;
duplicateCount: number;
conflictWithId?: string;
relationHint?: string;
}
export declare function formatCompanyBrainToolResult(label: string, result: CompanyBrainToolResult | null): string;
export declare function formatCompanyBrainContext(payload: CompanyBrainContextPayload, options?: {
maxChars?: number;
}): string;
declare function parseConfig(raw: unknown): EvaMemoryConfig;
/** Session risk mode for dynamic threshold selection. */
type InjectionMode = "critical" | "technical" | "personal";
Expand Down Expand Up @@ -190,6 +205,31 @@ declare const cortexPlugin: {
type: string;
description: string;
};
companyBrainContextMode: {
type: string;
enum: string[];
description: string;
};
companyBrainContextAccountId: {
type: string;
description: string;
};
companyBrainContextSearch: {
type: string;
description: string;
};
companyBrainContextFactsLimit: {
type: string;
description: string;
};
companyBrainContextEventsLimit: {
type: string;
description: string;
};
companyBrainContextMaxChars: {
type: string;
description: string;
};
};
required: never[];
};
Expand Down
2 changes: 1 addition & 1 deletion dist/index.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading