Skip to content

Commit bbb46d8

Browse files
committed
refactor(cognitive-pipeline): finish rename + clean lingering JSDoc refs
Replaces leftover `guardrails` variable name with `pipeline` in CognitivePipeline README and tests. Rewrites the remaining "multi-stage guardrails" references in ingest-router JSDoc plus the memory-router README link text to point at "Cognitive Pipeline" instead. No behavior change.
1 parent 630d913 commit bbb46d8

7 files changed

Lines changed: 38 additions & 39 deletions

File tree

src/cognitive-pipeline/README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ const ingestRouter = new IngestRouter({ /* ... */ });
6565
const memoryRouter = new MemoryRouter({ /* ... */ });
6666
const readRouter = new ReadRouter({ /* ... */ });
6767

68-
const guardrails = new CognitivePipeline({
68+
const pipeline = new CognitivePipeline({
6969
ingest: ingestRouterAsStage(ingestRouter),
7070
recall: memoryRouterAsStage(memoryRouter),
7171
read: readRouterAsStage(readRouter),
@@ -76,12 +76,12 @@ const guardrails = new CognitivePipeline({
7676

7777
```ts
7878
// Independent stages:
79-
await guardrails.ingest(newContent); // input stage
80-
const recalled = await guardrails.recall(query); // recall stage
81-
const answer = await guardrails.read(query, recalled.traces); // read stage
79+
await pipeline.ingest(newContent); // input stage
80+
const recalled = await pipeline.recall(query); // recall stage
81+
const answer = await pipeline.read(query, recalled.traces); // read stage
8282

8383
// End-to-end recall + read:
84-
const result = await guardrails.recallAndRead(query);
84+
const result = await pipeline.recallAndRead(query);
8585
console.log(result.outcome); // final answer
8686
console.log(result.recallStage.backend); // which memory backend ran
8787
console.log(result.readStage.strategy); // which reader strategy ran
@@ -92,13 +92,13 @@ console.log(result.recallStage.memoryRouterDecision); // full decision telemetry
9292

9393
```ts
9494
// Recall + read only (ingest is handled elsewhere):
95-
const guardrails = new CognitivePipeline({
95+
const pipeline = new CognitivePipeline({
9696
recall: memoryRouterAsStage(memoryRouter),
9797
read: readRouterAsStage(readRouter),
9898
});
9999

100-
await guardrails.recallAndRead(query); // works
101-
await guardrails.ingest(content); // throws MissingStageError
100+
await pipeline.recallAndRead(query); // works
101+
await pipeline.ingest(content); // throws MissingStageError
102102
```
103103

104104
### Custom stage implementations
@@ -117,7 +117,7 @@ const customIngest: IngestStage = {
117117
},
118118
};
119119

120-
const guardrails = new CognitivePipeline({
120+
const pipeline = new CognitivePipeline({
121121
ingest: customIngest,
122122
// ...
123123
});

src/cognitive-pipeline/__tests__/cognitive-pipeline.test.ts

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -61,48 +61,48 @@ function makeReadStage(): ReadStage<FakeTrace, FakeAnswer> {
6161
describe('CognitivePipeline: ingest stage', () => {
6262
it('forwards content to the configured IngestStage', async () => {
6363
const ingest = makeIngestStage();
64-
const guardrails = new CognitivePipeline<FakeTrace, FakeAnswer>({ ingest });
65-
const result = await guardrails.ingest('hello');
64+
const pipeline = new CognitivePipeline<FakeTrace, FakeAnswer>({ ingest });
65+
const result = await pipeline.ingest('hello');
6666
expect(ingest.ingest).toHaveBeenCalledWith('hello', undefined);
6767
expect(result.writtenTraces).toBe(1);
6868
});
6969

7070
it('throws when ingest is called without an IngestStage', async () => {
71-
const guardrails = new CognitivePipeline<FakeTrace, FakeAnswer>({});
72-
await expect(guardrails.ingest('hello')).rejects.toThrow(/IngestStage/);
71+
const pipeline = new CognitivePipeline<FakeTrace, FakeAnswer>({});
72+
await expect(pipeline.ingest('hello')).rejects.toThrow(/IngestStage/);
7373
});
7474
});
7575

7676
describe('CognitivePipeline: recall stage', () => {
7777
it('forwards query to the configured RecallStage', async () => {
7878
const recall = makeRecallStage();
79-
const guardrails = new CognitivePipeline<FakeTrace, FakeAnswer>({ recall });
80-
const result = await guardrails.recall('what is X?');
79+
const pipeline = new CognitivePipeline<FakeTrace, FakeAnswer>({ recall });
80+
const result = await pipeline.recall('what is X?');
8181
expect(recall.recall).toHaveBeenCalledWith('what is X?', undefined);
8282
expect(result.traces).toHaveLength(2);
8383
expect(result.backend).toBe('canonical-hybrid');
8484
});
8585

8686
it('throws when recall is called without a RecallStage', async () => {
87-
const guardrails = new CognitivePipeline<FakeTrace, FakeAnswer>({});
88-
await expect(guardrails.recall('q')).rejects.toThrow(/RecallStage/);
87+
const pipeline = new CognitivePipeline<FakeTrace, FakeAnswer>({});
88+
await expect(pipeline.recall('q')).rejects.toThrow(/RecallStage/);
8989
});
9090
});
9191

9292
describe('CognitivePipeline: read stage', () => {
9393
it('forwards query+traces to the configured ReadStage', async () => {
9494
const read = makeReadStage();
95-
const guardrails = new CognitivePipeline<FakeTrace, FakeAnswer>({ read });
95+
const pipeline = new CognitivePipeline<FakeTrace, FakeAnswer>({ read });
9696
const traces: FakeTrace[] = [{ id: 't1', text: 'e' }];
97-
const result = await guardrails.read('q?', traces);
97+
const result = await pipeline.read('q?', traces);
9898
expect(read.read).toHaveBeenCalledWith('q?', traces, undefined);
9999
expect(result.outcome.answer).toBe('answered: q?');
100100
});
101101

102102
it('throws when read is called without a ReadStage', async () => {
103-
const guardrails = new CognitivePipeline<FakeTrace, FakeAnswer>({});
103+
const pipeline = new CognitivePipeline<FakeTrace, FakeAnswer>({});
104104
await expect(
105-
guardrails.read('q?', []),
105+
pipeline.read('q?', []),
106106
).rejects.toThrow(/ReadStage/);
107107
});
108108
});
@@ -111,12 +111,12 @@ describe('CognitivePipeline: end-to-end recallAndRead', () => {
111111
it('chains recall + read in one call and returns full telemetry', async () => {
112112
const recall = makeRecallStage();
113113
const read = makeReadStage();
114-
const guardrails = new CognitivePipeline<FakeTrace, FakeAnswer>({
114+
const pipeline = new CognitivePipeline<FakeTrace, FakeAnswer>({
115115
recall,
116116
read,
117117
});
118118

119-
const result = await guardrails.recallAndRead('what is X?');
119+
const result = await pipeline.recallAndRead('what is X?');
120120

121121
expect(recall.recall).toHaveBeenCalledTimes(1);
122122
expect(read.read).toHaveBeenCalledTimes(1);
@@ -128,17 +128,17 @@ describe('CognitivePipeline: end-to-end recallAndRead', () => {
128128
});
129129

130130
it('throws on recallAndRead when recall stage is missing', async () => {
131-
const guardrails = new CognitivePipeline<FakeTrace, FakeAnswer>({
131+
const pipeline = new CognitivePipeline<FakeTrace, FakeAnswer>({
132132
read: makeReadStage(),
133133
});
134-
await expect(guardrails.recallAndRead('q')).rejects.toThrow(/RecallStage/);
134+
await expect(pipeline.recallAndRead('q')).rejects.toThrow(/RecallStage/);
135135
});
136136

137137
it('throws on recallAndRead when read stage is missing', async () => {
138-
const guardrails = new CognitivePipeline<FakeTrace, FakeAnswer>({
138+
const pipeline = new CognitivePipeline<FakeTrace, FakeAnswer>({
139139
recall: makeRecallStage(),
140140
});
141-
await expect(guardrails.recallAndRead('q')).rejects.toThrow(/ReadStage/);
141+
await expect(pipeline.recallAndRead('q')).rejects.toThrow(/ReadStage/);
142142
});
143143
});
144144

src/ingest-router/IngestRouter.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
* ingest classifier and the pure {@link selectIngestStrategy} into a
55
* single per-content routing call.
66
*
7-
* Same shape as MemoryRouter (recall-stage) so the multi-stage guardrails
8-
* orchestrator can compose them uniformly. Decide-only and decide+dispatch
7+
* Same shape as MemoryRouter (recall-stage) so Cognitive Pipeline can
8+
* compose them uniformly. Decide-only and decide+dispatch
99
* flows are both supported.
1010
*
1111
* @module @framers/agentos/ingest-router/IngestRouter

src/ingest-router/classifier.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@
33
* @description LLM-as-judge classifier that maps a piece of content to
44
* one of the six {@link IngestContentKind} values.
55
*
6-
* Same shape as the memory-router classifier — deliberately so the
7-
* multi-stage guardrails orchestrator can compose them with one mental
8-
* model.
6+
* Same shape as the memory-router classifier, deliberately so Cognitive
7+
* Pipeline can compose them with one mental model.
98
*
109
* @module @framers/agentos/ingest-router/classifier
1110
*/

src/ingest-router/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
* AgentOS IngestRouter Module
33
*
44
* Input-stage LLM-as-judge orchestrator for memory ingest. Sibling of
5-
* {@link MemoryRouter} (recall-stage), {@link QueryRouter} (Q&A-stage),
6-
* and the output-stage guardrails. Together they form the agentos
7-
* multi-stage guardrails pattern.
5+
* {@link MemoryRouter} (recall-stage) and {@link QueryRouter} (Q&A-stage).
6+
* IngestRouter is the first stage in the agentos Cognitive Pipeline
7+
* pattern; output-stage guardrails remain a separate downstream concern.
88
*
99
* Where MemoryRouter picks the recall architecture for a query,
1010
* IngestRouter picks the storage architecture for incoming content. The

src/ingest-router/select-strategy.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
* predicted content kind + routing table + budget policy.
55
*
66
* Stateless. Deterministic. No I/O. Same shape as
7-
* {@link selectBackend} in memory-router so the multi-stage guardrails
8-
* orchestrator can compose them uniformly.
7+
* {@link selectBackend} in memory-router so Cognitive Pipeline can compose
8+
* them uniformly.
99
*
1010
* @module @framers/agentos/ingest-router/select-strategy
1111
*/

src/memory-router/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ Calibrating your own cost-points takes one sweep per backend across a representa
250250

251251
- `@framers/agentos/query-router` — general Q&A routing (vector search / graph / keyword). Sibling primitive; different use case (ask-a-question vs recall-past-context).
252252
- `@framers/agentos/memory` — the underlying Memory + HybridRetriever + SessionRetriever primitives the canonical-hybrid backend calls.
253-
- `@framers/agentos/core/guardrails` — output-stage guardrails. MemoryRouter is the input-stage guardrail that picks architecture; core/guardrails validate the output.
253+
- `@framers/agentos/core/guardrails` — output-stage guardrails. MemoryRouter is the recall-stage orchestrator that picks architecture; core/guardrails validate the output.
254254
- `@framers/agentos-ext-grounding-guard` — output-stage grounding judge for retrieved-evidence-backed answers.
255255

256-
Together, these form the multi-stage guardrails pattern: `ingest → memory-router → retrieve → read → core/guardrails + grounding-guard`. Each stage is an LLM-as-judge decision point with its own interface.
256+
Together, the router stages form the Cognitive Pipeline pattern: `ingest-router → memory-router → read-router`. The ingest, recall, and read stages are LLM-as-judge orchestration points with their own interfaces. In a full app, `core/guardrails` and `agentos-ext-grounding-guard` run downstream as safety/policy validators.

0 commit comments

Comments
 (0)