Context Intent Recommender is a small local prototype for agent frontends. It captures the user's current browser context, sends it to a local runtime, and returns the most useful next action, such as summarize, reply, translate, review code, or ask the user for more context.
The project is intentionally local-first:
- The Chrome extension captures the active tab context.
- The local runtime stores the latest snapshot and exposes simple HTTP APIs.
- The CLI prints the latest recommendation or hands an action to Codex CLI.
- A deterministic router is included as an offline fallback and test target.
The extension produces a ContextSnapshot:
{
"app": "chrome",
"url": "https://github.com/example/project/pull/123",
"pageTitle": "Fix auth redirect by alice - Pull Request #123",
"hasSelection": false,
"selectedText": "",
"selectionTextClass": "empty",
"isEditing": false,
"visibleContentSummary": "Conversation Commits Checks Files changed Review changes diff...",
"sourceMeta": {
"source": "chrome_extension",
"timestamp": 1782145299149,
"visibleTextCharCount": 1000,
"selectedTextCharCount": 0
}
}This is a live-page context bridge, not a URL scraper. It can capture logged-in pages and selections because the user explicitly runs the extension on the active tab.
- Node.js 22 or newer
- Chrome or Chromium
- Optional: Codex CLI installed and authenticated for
frontend show
If Codex CLI is not available, use frontend show --router for the deterministic
offline router.
git clone https://github.com/BrickerP/context-intent-recommender.git
cd context-intent-recommender
npm install
npm linknpm link makes the frontend command available from your shell. If you do not
want to link it, replace frontend ... commands with node scripts/frontend.js ....
In one terminal:
npm run runtimeBy default it listens on:
http://127.0.0.1:8787
Useful endpoints:
POST /contextstores the latest extension snapshot.GET /contextreturns the latest stored snapshot.GET /recommendruns the deterministic fallback router on the latest snapshot.GET /agent?actionId=<id>builds a Codex CLI handoff prompt.GET /healthchecks whether the runtime is alive.
If port 8787 is already occupied by this runtime, the server exits cleanly and
tells you to use the existing process.
- Open
chrome://extensions. - Enable
Developer mode. - Click
Load unpacked. - Select this folder:
<repo>/chrome-extension
Then open any normal web page and click the extension icon. The popup will:
- Read the active tab context.
- Send it to
http://127.0.0.1:8787/context. - Show recommended actions, the raw context, and the runtime response.
Chrome does not allow this style of script injection on browser-internal pages
such as chrome://extensions.
After the extension has captured a page:
frontend showfrontend show asks Codex CLI to recommend actions using the captured
ContextSnapshot and the schema in schemas/agent-recommendation.schema.json.
For a fully offline deterministic result:
frontend show --routerPrint the raw latest context:
frontend contextBuild a prompt for a selected action:
frontend agent summarize_assessmentRun that selected action through Codex CLI:
frontend agent summarize_assessment --runnpm run runtimeLoad the extension, open a GitHub pull request, and click Refresh context.
frontend show --routerExample output:
Scene: github_pr (0.96)
Fallback: false
Router: rules_first_codex_handoff
Context: Fix auth redirect by alice - Pull Request #123
1. Summarize PR changes [summarize_changes] 0.91
2. Draft a code review [write_review] 0.9
3. Find potential risks [find_risks] 0.86
Chrome extension
-> collects ContextSnapshot from the active tab
-> POST /context to local runtime
-> runtime stores latest snapshot
-> CLI reads latest snapshot
-> Codex CLI agent or deterministic router recommends actions
The runtime intentionally keeps a small router surface. For product use, the agent can own semantic reasoning while the deterministic router remains a fast, offline, explainable fallback.
Run tests:
npm testCheck the CLI syntax:
node --check scripts/frontend.js
node --check scripts/runtime-server.jsRuntime request failed: start the runtime withnpm run runtime.Codex agent recommendation failed: install/authenticate Codex CLI, or usefrontend show --router.- Extension cannot capture a page: reload the target page and avoid
chrome://browser-internal pages. - No context yet: click the extension popup's
Refresh contextbutton on a normal page.