|
| 1 | +--- |
| 2 | +doc-class: governance |
| 3 | +subsystem: browser |
| 4 | +implementation-status: target-state |
| 5 | +last-verified: 2026-09-29 |
| 6 | +verified-against: 6597099c |
| 7 | +supersedes: [61ed0677:Docs/architecture/browser/BROWSERNERD-PARITY.md] |
| 8 | +--- |
| 9 | + |
| 10 | +# BrowserNERD 1.2.0 Parity Contract |
| 11 | + |
| 12 | +> Restated 2026-09-29. Supersedes the initial parity contract from commit 61ed0677 (deleted 2026-09-20). |
| 13 | +> Incorporates the BrowserNERD 1.2.0 delta (through commit 1396e5309) and the uncommitted process-reaper subsystem. |
| 14 | +
|
| 15 | +## 1. Upstream and Local Baselines |
| 16 | + |
| 17 | +The authoritative upstream source of truth for BrowserNERD 1.2.0 capabilities is the CrossThread repository at `C:\CodeProjects\SybioGenv3\crossthread\dev_tools\BrowserNERD` at commit `0806144c6` (with the latest touching commit `1396e5309`), augmented with the twelve uncommitted working-tree files in that directory. The nested git repository at `dev_tools/BrowserNERD/.git` (HEAD `8b61e09`, dated 2026-08-01) is two months stale and is explicitly rejected as a source. The uncommitted upstream files represent the Chrome process tree reaper and its integration (`reaper.go`, `reaper_windows.go`, `reaper_unix.go`, `reaper_test.go`, and their wiring into `browser_instances.go`, `session_core.go`, `server.go`, and `server_doctor.go`). |
| 18 | + |
| 19 | +The codeNERD baseline is commit `6597099c`. Previous parity reviews evaluated baseline codeNERD at `9170ad07` and `231cfa7`. |
| 20 | + |
| 21 | +## 2. Meaning of Parity |
| 22 | + |
| 23 | +Parity means that every operational and reasoning capability of BrowserNERD 1.2.0 is fully reachable through codeNERD's production runtime, safely bounded, governed by logic, and backed by verifiable automated tests. |
| 24 | + |
| 25 | +Parity does not mean embedding BrowserNERD's standalone Model Context Protocol (MCP) server binary or running BrowserNERD's embedded secondary Mangle engine inside codeNERD. The architectural split adheres to the following binding adaptation rules: |
| 26 | + |
| 27 | +- **Single Live Kernel**: Browser observations and events enter codeNERD's unified live kernel (`RealKernel` / `SystemKernel`). There is no second, detached Mangle engine or parallel reasoning reality. |
| 28 | +- **Native Underscore Tools**: Agent-facing operations are exposed as native modular tools using codeNERD's snake_case convention: `browser_observe`, `browser_act`, `browser_reason`, `browser_audit`, `browser_mangle`, `browser_specs`, and `browser_test`. They are registered in the central tool catalog (`internal/tools/research/browser_progressive.go:14-95`, `internal/tools/research/browser_reasoning.go:99-178`). |
| 29 | +- **JIT Prompt Atoms**: Guidance and capability disclosure are delivered via Just-In-Time prompt atoms (`internal/prompt/atoms/capability/browser_progressive.yaml:1-48`), not by bloating static tool descriptions. |
| 30 | +- **Constitutional Governance**: All mutating browser actions remain subject to codeNERD's constitutional policy with default deny (`internal/core/defaults/policy/constitution.mg:150-175`). High-impact operations (such as file uploads or armed dialog accepts) require explicit, separate permission derivations. |
| 31 | +- **Workspace Authority Root**: Browser configuration and persistent artifacts live strictly under `.nerd/` or configured workspace roots (`internal/browser/session_manager.go:94-130`). There is no independent `.browsernerd` configuration authority. |
| 32 | +- **Attribution**: Source-derived code retains full attribution and notices under the Apache License, Version 2.0. |
| 33 | +- **Production Gate**: A capability or gap row is classified as done only when unit test coverage passes and live Chrome execution confirms the observable behavior through codeNERD's production routes. |
| 34 | + |
| 35 | +## 3. Scope Boundaries: What Is and Is Not Ported |
| 36 | + |
| 37 | +To protect codeNERD from architectural bloat and duplicate logic, strict boundaries govern what is ported from BrowserNERD 1.2.0: |
| 38 | + |
| 39 | +### Ported Components |
| 40 | + |
| 41 | +- **First-Byte Event Stream**: Pre-navigation CDP subscription lifecycle, frame attachment, and comprehensive event capture. |
| 42 | +- **Page Hooks and DOM Sensing**: Early script hooks for capturing route announcements, toast notifications, console events, unhandled exceptions, and page lifecycle failures before page scripts execute. |
| 43 | +- **Progressive Observation**: Observation modes including compact summaries, navigation graphs, interactive element handles, data grids, hidden elements, raw text, and storage metadata (cookies and web storage with JWT expiration extraction). |
| 44 | +- **Surgical Locators and Actions**: Validated sequential action batches supporting element references, visible text, labels, roles, and coordinates, with post-action verification and effects summaries. |
| 45 | +- **Deductive Reasoning Rules**: Causal temporal diagnosis rules, bucketed request failure correlations, asset-type 4xx discrimination, and action candidate ranking. |
| 46 | +- **Safe Process Lifecycle**: Rod launcher configuration with `Leakless(false)` to prevent antivirus quarantining, process-tree tracking, and automated orphan reaping at process boundaries. |
| 47 | +- **Declarative Test Fixtures**: Portable, selector-free test execution and assertion fixtures. |
| 48 | + |
| 49 | +### Explicitly Excluded Components |
| 50 | + |
| 51 | +- **Secondary Mangle Engine**: Files implementing BrowserNERD's standalone deductive engine (`indexed_store.go`, `engine.go`, `closure.go`, `catalog.go`, `stats.go`, `query_check.go`, and `schemas/embed.go`) are not ported. Their deductive rules are ported directly into codeNERD's declarative corpus (`internal/core/defaults/schemas_browser.mg` and `internal/core/defaults/policy/browser.mg`). |
| 52 | +- **Standalone MCP Server and Server Doctor**: Upstream MCP protocol wrappers in BrowserNERD (`mcp-server/cmd/server/main.go`, `mcp-server/internal/mcp/server.go`, `mcp-server/internal/mcp/server_doctor.go`) are not ported. Diagnostics are exposed through codeNERD's native Go health checks and tools. |
| 53 | +- **Arbitrary JavaScript Execution (BP-19)**: Upstream or unconstrained JavaScript execution tools are intentionally omitted. Browser automation is restricted to closed, typed operations. |
| 54 | +- **Repository Tracing and Contract Audit Expansion**: `internal/browser/repo_trace.go` and `internal/browser/contract_audit.go` are distinct capabilities under independent maintenance and are not modified by this port. |
| 55 | + |
| 56 | +## 4. The "Even Better" Design Mandate |
| 57 | + |
| 58 | +Rather than creating a verbatim copy of upstream Go code, codeNERD adopts twelve specific architectural enhancements where BrowserNERD's imperative Go logic is elevated into native Mangle deductive rules: |
| 59 | + |
| 60 | +1. **Asset 4xx Discrimination in Logic**: Go asserts the raw CDP resource type in HTTP error facts. Mangle rules discriminate asset failures (images, fonts, stylesheets, media) from actionable API failures. |
| 61 | +2. **Bucketed Causal Chain Reasoning**: Causal failure correlations are derived in Mangle using two-second time buckets, eliminating quadratic joins in Go. |
| 62 | +3. **Derived Action Effects**: Go settles the browser and records timestamps; Mangle derives the causal effects of the action batch. |
| 63 | +4. **Storage Expiry as Logic Facts**: Local and session storage inspection extracts keys and expiration timestamps without exposing raw credential values to the model, joining with authentication errors in logic. |
| 64 | +5. **Deductive Action Candidate Prioritization**: Interactive element ranking is derived by Mangle rules; Go merely handles layout grouping. |
| 65 | +6. **Default-Deny Dialog Policy**: Dialog answers default to dismiss unless an explicit kernel fact authorizes an accept. |
| 66 | +7. **Constitutional Partitioning of Actions**: `browser_act` is partitioned so safe read-only or low-impact interactions remain permitted, while uploads and dialog accepts require distinct authorization. |
| 67 | +8. **Signal-Aware Fact Retention**: When the fact buffer approaches saturation, low-signal polling events are evicted first, ensuring failure evidence is preserved. |
| 68 | +9. **Lifecycle-Bounded Process Reaping**: Process cleanup runs exclusively during system startup and shutdown, never as an agent-callable tool. |
| 69 | +10. **Unattended Navigation Tracking**: Navigation events occurring outside explicit model actions are reified as facts and surfaced in the subsequent observation. |
| 70 | +11. **JIT Atom Token Discipline**: Tool descriptions remain concise; operational guidance is provided dynamically through prompt atoms, verified by token-budget tests. |
| 71 | +12. **Structured Backend Correlation**: Container log matching correlates specific failed requests by endpoint path, and comprehensive container failure produces an explicit error. |
| 72 | + |
| 73 | +## 5. Attribution and Licensing |
| 74 | + |
| 75 | +BrowserNERD is developed by theRebelliousNerd and licensed under the Apache License, Version 2.0. |
| 76 | + |
| 77 | +All ported files, adapted algorithms, and translated Mangle schemas must preserve the Apache-2.0 copyright notices. The central notice in `THIRD_PARTY_NOTICES.md:3-20` is maintained and updated to cite the expanded scope of adapted browser automation, observation, and reasoning capabilities. |
0 commit comments