コース目次

アカデミーモジュール 6 · Beyond notes

Code intelligence: a terminal and a graph for your code

全4レッスン中 2番目10分

このレッスンで学ぶこと

  • You can open, hide, resize, and kill terminal tabs, and explain why hiding never stops a shell.
  • You can hand a terminal's recent output to the AI with an @-mention and say exactly what gets captured.
  • You can explain how code intelligence maps symbols and cross-file relationships as triples, entirely on-device.
  • You can build the code index, make the cloud-embeddings decision, and read the four build stages.
  • You can find code intelligence on every surface it touches: sidebar, notes, entity pages, and chat.

You run a build and it fails, eighty lines deep in stack traces. You want to ask the AI why, but copy-pasting all that output into a chat box is a chore. There's a bigger version of the same gap. Your workspace sits next to a codebase: your design notes describe features and some function implements them, but nothing connects the two.

This lesson covers the two developer tools that close those gaps. The first is the terminal dock: a real shell inside the workspace window, with a one-keystroke bridge to the AI. The second is code intelligence, which maps your source code into a graph using the same triple discipline the app uses on your notes.

A real terminal, docked at the bottom

The terminal dock is a VSCode-style bottom panel that runs your real shell in a true PTY, the operating system's real terminal channel: zsh or bash on macOS, PowerShell or cmd on Windows. Prompts, colors, aliases, job control, vim, less, it all behaves like a standalone terminal, because it is one.

The shell comes from your $SHELL variable and launches login-style, so your PATH and aliases load. New shells start in the active workspace folder, so ls lists your notes right away.

Opening the dock splits the editor vertically without covering anything. The dock only exists while a workspace is open; on the Home screen the button hides and the shortcut does nothing.

  • Titlebar: the square-terminal icon in the right-hand tool cluster. Its tooltip reads "Terminal" with ⌘`, and it stays pressed while the dock is open.
  • Keyboard: ⌘` (Ctrl+` on Windows/Linux) toggles the dock, just like VSCode. You can rebind it in Settings ▸ Shortcuts as "Toggle terminal".
  • macOS menu bar: View ▸ "Toggle Terminal".
  • "Search everything" palette (⌘⇧F): run the "Toggle terminal" entry. It shows your current shortcut, rebound or not.
  • GitHub sign-in: when it can't use the automatic device flow, the dialog offers "Open terminal" and hints to run gh auth login.

Tabs, hide vs. kill

ControlWhereWhat it does
+ ("New Terminal")Dock header, next to the tabsOpens a fresh shell tab in the workspace folder and focuses it. Tabs are named "Terminal 1", "Terminal 2"… in the order you create them.
Double-click a tabTab stripOpens the "Rename" dialog. Name your shells "dev server", "git", whatever tells them apart.
✕ on a tab ("Kill terminal")Visible on hover and on the active tabEnds that shell process for real. Killing the last tab also collapses the panel.
Chevron ("Close panel")Dock header, right sideHides the dock. Every shell keeps running with its scrollback intact.
Drag the top edgeThin line above the dockResizes the split. The height sticks across restarts (default 300px, minimum 120px, and at least 120px of editor always stays visible).

Collapsing a panel does not kill it. Closing with the chevron or ⌘ only hides it, so shells keep running and scrollback survives. ⌘ works even while your cursor is inside the terminal, and only the ✕ ("Kill terminal") ends a process.

If a shell exits on its own, say you type exit or it crashes, a dim "[process exited]" line appears. The dead tab stays until you close it. There's no restart button, so kill it and open a new one.

Handing your shell to the AI

Here's what no standalone terminal can do. In the chat composer, type @ and the mention picker offers a "Terminals" category. Pick one and a chip like @Terminal 1 lands in your message, carrying a snapshot of that terminal's recent output, captured the moment you picked it.

Ask "why did this build fail?" and the agent reads that output. No copy-paste, no screenshots.

理解度チェック

You @-mention "Terminal 1" right after a build fails. While you type your question, the build prints 40 more lines. What does the agent see?

Code intelligence: code as triples

The second tool wakes up the moment your workspace contains source code. A local indexer reads it: a fast on-device parser, with no AI model and no network calls.

It records every symbol and every cross-file relationship as triples in a per-workspace code-graph store. Functions, methods, classes, structs, enums, traits, modules, type aliases, constants: all of them. It respects .gitignore, skips hidden directories, and runs at roughly 8 ms per file, so it's fast and free.

On top of that deterministic map sits an optional cloud pass. You opt in first, and then it embeds short code excerpts so code becomes searchable by meaning. The same pass puts your notes and concepts in one shared vector space, the cross-modal bridge.

The real code view, running live. Click a symbol to trace where it goes.
The shape of the code graph: files and symbols joined by four kinds of edge
graph.ts      imports →     types.ts
buildGraph()  calls →       parseNote()
NoteIndex     extends →     BaseIndex
render.ts     references →  buildGraph()
PTY (pseudo-terminal)
A real, OS-level terminal channel. That's why prompts, colors, vim, and job control all behave normally in the dock.
Code graph / code index
A deterministic, local map of your source code: files and symbols as nodes, calls / imports / extends / references as edges, stored per workspace as triples.
Semantic code embeddings
An optional cloud pass, which you consent to once, that makes code searchable by meaning rather than by exact words.
Cross-modal bridge
Code symbols and note/concept labels embedded in one vector space, so the app can rank "which code is closest to this concept" and vice versa, shown as a match %.
LSP (language server)
An external per-language server found on your PATH that powers autocomplete, hover, and go-to-definition. Without one, the editor navigates with the code graph instead.
LanguageIndexed in the code graphIDE features (language server)
Rust (.rs)Yesrust-analyzer
TypeScript / TSXYestypescript-language-server
JavaScriptYestypescript-language-server
Python (.py)Yespyright
Go (.go)YesNone (graph navigation only)

Building the index

  1. Open the management panel

    In the knowledge graph view, choose "Code intelligence" in the left menu. The build section is titled "Code in AI search". (If the master switch is off, you'll see "Code intelligence is off" with an "Open Settings" button. The toggle lives in Settings ▸ Code intelligence.)

  2. Press "Build"

    The row "Build code index" scans your source files, respecting .gitignore. A staged checklist runs: "Scan files" → "Parse code" → "Link references" → "Embed symbols", each with a live done/total count. "Cancel" stops it anytime.

  3. Decide on cloud embeddings

    On the first build a one-time dialog asks "Make your code searchable by meaning?" "Turn on meaning-based search" enables the semantic layer. "Keep everything on this device" keeps the index local-only. Either way, identifier and graph search still work, and the local index builds in every case.

  4. Read the verdict

    When it finishes, the plain-language verdict reads "Your code is searchable". From there a file watcher keeps the index current as files change, and "Rebuild" is the escape hatch for a stale or wrong index.

Where code intelligence shows up

  • The workspace sidebar grows a "Code context" group when a code tab is active. "Code graph" carries a live badge ("Indexed" / "Not indexed" / "Parse error") and lists "Defined symbols", "Used by", and "Uses". Every row is a jump, tagged with its relationship: calls / imports / extends / references.
  • "Related knowledge", in the same group, follows your caret. Put the cursor in a function and it lists the notes and concepts closest in meaning; "View as graph" opens a 3D constellation around the symbol.
  • "Related code" shows up on both a note's document sidebar and entity pages, taking you from prose or a 360° profile straight into the symbols that implement it.
  • "Concept ↔ code", in the Code intelligence panel: search a concept, expand it, and get the matching symbols ranked by a match %. Click one to open the file.
  • Chat: once the index completes, the agent can map the repository, search code by meaning, and follow a symbol's neighbors. Workspace search results grow a "Code" section.
  • The 3D graph has a "Show code" toggle that renders code files as their own node class. The file tree marks unprocessed code files with a red status dot and parse errors with a warning triangle.

Classic IDE features layer on top once an external language server is installed: F12 (or Cmd-click) to go to definition, Shift+F12 for references, F2 to rename across files, ⇧⌥F to format, plus diagnostic squiggles as you type. When a code file opens without its server, a one-time toast links to the install page, naming the language: "Richer TypeScript support available". Until then the editor quietly navigates via the code graph instead.

理解度チェック

You clicked "Keep everything on this device" in the consent dialog. Which of these keeps working?

That's the developer pair: a real shell one keystroke away with a one-chip bridge into the chat, and a codebase mapped with the same triple discipline as your notes. Ideas and their implementations can finally find each other. Those same triples can carry coordinates too, and the agent will draw them for you on a map.

Code intelligence: a terminal and a graph for your code · Consilience Academy