| layout | default |
|---|---|
| title | Chapter 1: Getting Started |
| nav_order | 1 |
| parent | Cipher Tutorial |
Welcome to Chapter 1: Getting Started. In this part of Cipher Tutorial: Shared Memory Layer for Coding Agents, you will build an intuitive mental model first, then move into concrete implementation details and practical production tradeoffs.
This chapter gets Cipher installed and running in local interactive mode.
npm install -g @byterover/ciphercipherYou can also run one-shot prompts:
cipher "Add this pattern to memory for future debugging"You now have Cipher running with a baseline local session.
Next: Chapter 2: Core Modes and Session Workflow
The sleep function in bin/kill-daemon.js handles a key part of this chapter's functionality:
} from '@campfirein/brv-transport-client'
function sleep(ms) {
return new Promise((resolve) => {
setTimeout(resolve, ms)
})
}
async function waitForProcessExit(pid, deadlineMs, pollMs) {
const deadline = Date.now() + deadlineMs
while (Date.now() < deadline) {
if (!isProcessAlive(pid)) {
return true
}
// eslint-disable-next-line no-await-in-loop
await sleep(pollMs)
}
return false
}
const status = discoverDaemon()
// Extract PID from any discovery result that has one
const pid = status.running
? status.pid
: 'pid' in status
? status.pid
: undefined
if (pid === undefined || !isProcessAlive(pid)) {This function is important because it defines how Cipher Tutorial: Shared Memory Layer for Coding Agents implements the patterns covered in this chapter.
The waitForProcessExit function in bin/kill-daemon.js handles a key part of this chapter's functionality:
}
async function waitForProcessExit(pid, deadlineMs, pollMs) {
const deadline = Date.now() + deadlineMs
while (Date.now() < deadline) {
if (!isProcessAlive(pid)) {
return true
}
// eslint-disable-next-line no-await-in-loop
await sleep(pollMs)
}
return false
}
const status = discoverDaemon()
// Extract PID from any discovery result that has one
const pid = status.running
? status.pid
: 'pid' in status
? status.pid
: undefined
if (pid === undefined || !isProcessAlive(pid)) {
console.log('[kill-daemon] No running daemon found')
} else {
console.log(`[kill-daemon] Stopping daemon (PID ${pid})...`)
let stopped = falseThis function is important because it defines how Cipher Tutorial: Shared Memory Layer for Coding Agents implements the patterns covered in this chapter.
The startRepl function in src/tui/repl-startup.tsx handles a key part of this chapter's functionality:
* Start the ByteRover REPL
*/
export async function startRepl(options: ReplOptions): Promise<void> {
const {version} = options
// Set version in store before rendering
useTransportStore.getState().setVersion(version)
const {waitUntilExit} = render(
<AppProviders>
<App />
</AppProviders>,
)
await waitUntilExit()
}This function is important because it defines how Cipher Tutorial: Shared Memory Layer for Coding Agents implements the patterns covered in this chapter.
The ReplOptions interface in src/tui/repl-startup.tsx handles a key part of this chapter's functionality:
* - TransportInitializer connects to daemon via connectToDaemon()
*/
export interface ReplOptions {
version: string
}
/**
* Start the ByteRover REPL
*/
export async function startRepl(options: ReplOptions): Promise<void> {
const {version} = options
// Set version in store before rendering
useTransportStore.getState().setVersion(version)
const {waitUntilExit} = render(
<AppProviders>
<App />
</AppProviders>,
)
await waitUntilExit()
}This interface is important because it defines how Cipher Tutorial: Shared Memory Layer for Coding Agents implements the patterns covered in this chapter.
flowchart TD
A[sleep]
B[waitForProcessExit]
C[startRepl]
D[ReplOptions]
E[fuzzyMatch]
A --> B
B --> C
C --> D
D --> E