Adopt with observe
guides / v1
Start with a read and observe
Build the local SDK as described in Quickstart, select observe explicitly, await ready, and wrap the boundary you own. The validated synthetic example below retains the exact result object and never enables a repair path. Default detection is off without explicit selections.
Read candidates without applying them
Subscribe with sdk.on to drift, repair, blocked, bypass and error events, or inspect sdk.recent(). A proposed patch is not an applied repair. The second snippet injects a labelled synthetic candidate engine and asserts that observe retains the original object even when a replacement is offered. Observe never mutates even when a trusted engine proposes a replacement. A bypass means inspection was unavailable; it is not clean drift evidence.
When to stay in observe
Do not switch based on candidate count or recovery rate alone. Require representative baseline/live windows, scoped operation identities, verified patches and violation-rate evidence. Missing evidence, cold baselines and unsupported captures need investigation. The default guest has no selective repair output; changing mode cannot supply it. Semantic writes remain protected in repair mode; strict requires explicit review handling.
Continue
Keep configuration, call decisions and evidence separate.
import { createAgindow } from '@agindow/node';
const sdk = createAgindow({ mode: 'observe' });
await sdk.ready;
const payload = { id: 'synthetic-customer' };
let calls = 0;
const read = sdk.guard(() => { calls++; return payload; }, { tool: 'vendor.read', operation: 'read' });
const result = read();
if (result !== payload || calls !== 1) throw Error('Fixture identity changed');
// A labelled unavailable-engine fixture produces one bypass without a hosted key.
const unavailable = createAgindow({ mode: 'observe' }, async () => { throw Error('Synthetic loading fault'); });
await unavailable.ready;
const fallback = unavailable.wrap(() => payload);
if (fallback() !== payload || unavailable.recent().filter(e => e.type === 'bypass').length !== 1) throw Error('Missing bypass');
sdk.configure({ mode: 'observe' });
console.log('Synthetic fixture: original result retained; unavailable engine bypassed once.');import { createAgindow } from '@agindow/node';
import type { Verdict } from '@agindow/node';
const pass: Verdict = { halt: false, bypassed: false, class: null, findings: 0, detectors: 0, malformed: false };
const payload = { old: 'synthetic-value' };
// Synthetic candidate engine: only a fixture, not the default WASM engine.
const sdk = createAgindow({ mode: 'observe' }, async () => ({
begin: () => ({ request: pass, close() {}, finish: () => ({ ...pass,
class: 'shape', findings: 1, confidence: 0.99,
repair: { verified: true, value: { current: 'synthetic-value' }, changes: [{ path: 'old', kind: 'field_renamed', to: 'current' }] },
}) }),
}));
await sdk.ready;
const result = sdk.guard(() => payload, { tool: 'vendor.read' })();
if (result !== payload || !('old' in result)) throw Error('Observe applied a candidate');
console.log('Synthetic fixture: offered patch remained unapplied in observe.');