Routed by strong_core intent. Constrains edit boundary and forbidden paths.
K² Agent Context Demo
K² turns private knowledge into cited context for agents
The same source-role-separated context pattern as the Java case study, now applied to Angular forms-signals. K² routes broad and focused tasks to the right guide family before the coding agent edits TypeScript.
Same external coding agent. Better context before the edit.
Which guide rules, source files, and tests should I use before adding an includeDisabled opt-in to compat extractValue?The context package tells the agent which guide family and source pair to use.
Versioned docs slice. Pinned to angular/angular@9a7dedced6.
packages/forms/signals/compat/src/api/extract.tsCanonical source neighbor for compat-class extractions.
extract_value.spec.tsFocused spec. Adds default-exclusion and opt-in inclusion regression coverage.
Forbidden paths enforced by the patch plan and verified by the scorecard.
- Added
includeDisabledtoExtractFilter - Inserted disabled-skip guard in
visitFieldTree - Extended
extract_value.spec.ts
Coding agents need to know whether retrieved text is a rule, an API contract, implementation precedent, or a spec expectation. K² preserves that role through collections, metadata filters, named agents, and citations instead of flattening every source into one undifferentiated prompt.
K² keeps guides, docs, code, and tests separated, asks bounded agents in a declared order, and lets a Knowledge Feed promote repeated source findings back into durable guidance.
Private knowledge becomes a cited context package before the edit.
Guides, docs, source, and tests stay separated through retrieval, then K² assembles the relevant pieces into a cited package the coding agent can use before it changes TypeScript code.
Developers need a short reproducible setup. Enterprise buyers need a controlled pilot against their current coding-agent workflow. The same architecture supports both paths.
Load the public demo bundle, connect the MCP server to a coding agent, and run one cited retrieval query.
Enterprise pilotRun a pilot on your codebaseFreeze tasks and scoring with the customer technical lead, ingest customer docs/code, and compare against their current workflow.
The customer-facing claim should be earned on customer assets. Use this public benchmark to scope a bounded replication, not as a forecast for a financial TypeScript application.
Run the same workflow on customer assets.
- Pick one representative Angular package and one Confluence page tree of forms or state conventions.
- Freeze 10-25 real feature-development tasks before the pilot run.
- Run the same coding agent, for example Codex or Claude Code, with and without K² retrieval.
- Score accepted patches, review rework, focused tests, token use, wall-clock time, and retrieval cost.
Validate on customer code before making any customer-specific claim.
- This is a public benchmark and demo bundle, not a named customer replication.
- Design partners should freeze tasks, expected files, guide checks, and scorer logic before indexing.
- Publish customer-approved relevance findings, even if the customer name remains anonymized.
Add an includeDisabled opt-in to Angular compat extractValue
The coding agent should identify the right guide family, version-pinned docs, source neighbor, and the focused spec before editing TypeScript.
On the v2 routing run, K² MCP leads on accepted patches across 12 task classes with a higher mean rubric score and lower agent-token spend than either Context7 public-docs MCP or a local guide dump.
K² mean rubric score 0.949 vs Context7 0.914 vs local guide dump 0.923. Mean guide-guardrail score 0.956 for K², up from 0.680 on the prior routing run.
Token math is agent-side: retrieved snippets count once they enter the coding-agent prompt, but K² platform retrieval, ingestion, storage, and subscription costs are reported separately below. Do not quote this as a broad Context7 ranking or expected customer outcome.
Same 100-task v2 routing run, agent-side. K² uses ~46% fewer mean agent tokens than Context7 and is ~2.5x more efficient per accepted patch.
Token efficiency tracks accepted work, not only attempted work. The headline efficiency comes from K² producing 63/100 accepted patches versus 46/100 for Context7 and 47/100 for the local guide dump at lower per-task cost.
K² retrieves guide rules and the rubric rewards guide compliance, so the table reports both the accepted-patch count and the mean rubric score. The per-class breakdown below shows where the lift comes from.
Scoring rubric
| Component | Weight |
|---|---|
| Expected files/modules touched | 30% |
| Required behavior or diff-pattern checks | 25% |
| Guide guardrail compliance (citation + forbidden paths) | 20% |
| Diff present and well-formed | 10% |
| Verification (focused tests, type-check, parse) | 10% |
| Review scope and safety | 5% |
Accepted patches and mean score by arm
| Arm | Mean score | Accepted |
|---|---|---|
| K² MCPAngular guides, source, tests, and version-pinned docs through K² with intent-routed retrieval. | 0.949 mean | 63 / 100 |
| Local guide dumpAll nine guides concatenated and pasted into the agent prompt before each task. | 0.923 mean | 47 / 100 |
| Context7 public-docs MCPPublic Angular documentation through Context7, without private guide/source/test corpora. | 0.914 mean | 46 / 100 |
Per-class accepted patches
| Class | K² | Context7 | Local |
|---|---|---|---|
validation_rule | 18/18 | 18/18 | 18/18 |
state_rule | 8/8 | 5/8 | 5/8 |
field_state | 8/14 | 1/14 | 1/14 |
compat_api | 6/12 | 4/12 | 6/12 |
structure_api | 4/7 | 4/7 | 3/7 |
validation_infrastructure | 4/8 | 3/8 | 5/8 |
directive_integration | 3/12 | 2/12 | 1/12 |
control_api | 3/3 | 0/3 | 0/3 |
utility | 3/5 | 1/5 | 1/5 |
metadata_rule | 3/5 | 5/5 | 4/5 |
schema_internals | 2/5 | 2/5 | 2/5 |
webmcp_integration | 1/3 | 1/3 | 1/3 |
Cost model
- Agent-token numbers count prompt and completion tokens captured by the benchmark runner. Retrieved K² snippets are included once they enter the agent prompt.
- K² uses about 46% fewer mean agent tokens than Context7 and about 41% fewer than the local guide dump on this 100-task run.
- Per accepted patch, K² is about 2.52x more token-efficient than Context7 and 2.26x more efficient than the local guide dump.
- K² platform cost is not hidden in the token-savings number. It includes ingestion, retrieval queries, storage, and subscription.
- Illustrative benchmark-scale platform allocation: Pro tier at $249/month for this demo corpus and run.
- If accepted patches are the customer-relevant outcome because guide violations create review rework, K² platform allocation is $249 / 63 ≈ $3.95 per accepted patch before model-token cost.
- At Claude Sonnet-style input pricing around $3 per million tokens, the 4.09M agent-token savings per accepted patch versus Context7 is about $12.27, roughly 3.1x the benchmark-scale K² platform allocation.
- These numbers do not include developer time. One avoided review or re-prompt hour at a $150 loaded engineering cost dwarfs the token and platform costs combined.
Authorship and freeze disclosure
The public artifact does not independently prove that task authors, guide authors, and scorer authors were blind to K² outputs before freezing. The defensible public claim is therefore narrower: K² improved this guide-retrieval-heavy benchmark across 12 Angular forms-signals task classes, and customer-specific claims require a frozen customer replication before indexing or running any arm.
Task definitions, scorer configurations, prompt templates, selected raw responses, patch artifacts, and demo asset manifests are published in the repository. An external reviewer can rerun the public benchmark with the same coding-agent model, a K² API key, and the published bundle; customer-specific claims still require customer-frozen tasks and customer-owned corpora.
diff --git a/packages/forms/signals/compat/src/api/extract.ts b/packages/forms/signals/compat/src/api/extract.ts@@ -51,6 +51,12 @@ export interface ExtractFilter { readonly dirty?: boolean; readonly touched?: boolean; readonly enabled?: boolean;+ /**+ * Whether disabled fields are included in the extracted value.+ *+ * Disabled fields are excluded by default to match the compat extraction behavior.+ */+ readonly includeDisabled?: boolean; } @@ -97,6 +103,10 @@ function visitFieldTree( const state = field(); const value = state.value(); + if (state.disabled() && filter?.includeDisabled !== true && filter?.enabled !== false) {+ return undefined;+ }+ const matchingChildren = extractChildren(field, value, filter); answer style:Generated from a flat guide-dump prompt; no per-task routing intent surfaced.diff --git a/packages/forms/signals/compat/src/api/extract.ts b/packages/forms/signals/compat/src/api/extract.ts@@ -51,6 +51,7 @@ export interface ExtractFilter { readonly dirty?: boolean; readonly touched?: boolean; readonly enabled?: boolean;+ readonly includeDisabled?: boolean; } @@ -74,6 +75,7 @@ export function extractValue<T>(field: FieldTree<T>): RawValue<T>; * * @param field The field tree to extract the value from. * @param filter Criteria to include only fields matching certain state (dirty, touched, enabled).+ * Set `includeDisabled` to `true` to include disabled controls in the extracted value. * @returns A partial value containing only the fields matching the filter, or `undefined` if none match. @@ -96,6 +98,11 @@ function visitFieldTree( ): RawValue<unknown> | DeepPartial<RawValue<unknown>> { const state = field(); const value = state.value();+ const includeDisabled = filter?.includeDisabled ?? false;++ if (!includeDisabled && filter?.enabled === undefined && state.disabled()) {+ return undefined;+ }K² spec, scorecard, and citations
ts + scorecarddiff --git a/packages/forms/signals/test/node/compat/extract_value.spec.ts b/packages/forms/signals/test/node/compat/extract_value.spec.ts@@ -84,6 +84,24 @@ describe('extractValue', () => { }); }); + it('should exclude disabled compat controls by default and include them when requested', () => {+ const lastNameControl = new FormControl({value: 'Doe', disabled: true});+ const model = {+ firstName: 'John',+ lastName: lastNameControl,+ };+ const f = compatForm(signal(model), {injector});++ expect(extractValue(f)).toEqual({+ firstName: 'John',+ });++ expect(extractValue(f, {includeDisabled: true})).toEqual({+ firstName: 'John',+ lastName: 'Doe',+ });+ }); scorecard:arm: codex_with_k2_mcpguide_cited: CF-ANGULAR-CORE-000required_diff_pattern_score: 1.00guide_guardrail_score: 1.00expected_file_coverage: 1.00accepted: true sources cited:repo://angular/angular@9a7dedced6/packages/forms/signals/compat/src/api/extract.tsrepo://angular/angular@9a7dedced6/packages/forms/signals/test/node/compat/extract_value.spec.tsgenerated://guides/angular/forms-signals-core-patch-boundary.mdLocal-dump answer excerpt
answer.mdChanges:
- Added includeDisabled?: boolean to ExtractFilter with a doc comment.
- Inserted a disabled-skip guard in visitFieldTree that respects existing enabled filtering.
- Added a focused spec that exercises both default exclusion and opt-in inclusion of a disabled compat control.
Tests:
- Attempted pnpm bazel test //packages/forms/signals/test/node:test --test_filter=extractValue
- Result: bazel runner not available in this environment.
Remaining uncertainty:
Runtime verification was not executed because Bazel was unavailable.Implemented the compat extract opt-in for disabled controls inside
the forms-signals core boundary.
What changed:
- Added includeDisabled?: boolean to ExtractFilter and documented it on extractValue.
- Updated visitFieldTree to skip disabled nodes by default while preserving explicit enabled filtering.
- Added a focused regression spec covering both default exclusion and the includeDisabled: true override.
Sources consulted:
- repo://angular/angular@9a7dedced6/packages/forms/signals/compat/src/api/extract.ts
- repo://angular/angular@9a7dedced6/packages/forms/signals/test/node/compat/extract_value.spec.ts
- generated://guides/angular/forms-signals-core-patch-boundary.md (CF-ANGULAR-CORE-000)
Guide compliance:
Edits stayed inside packages/forms/signals; no docs/guide pages were touched.