Perception IDE

Script Editor & AI Assistant

Perception.cx ships with a fully integrated code editor and AI assistant. It's a native overlay panel — no Electron, no browser runtime. Write, test, and iterate on scripts without ever leaving the platform.


Editor

Multi-Tab Editing

Open as many files as you want. Drag tabs to reorder, middle-click or click the × to close. Each tab tracks its own undo history, cursor position, and unsaved state.

Syntax Highlighting

17 languages are supported: AngelScript, Lua, C/C++, Rust, JavaScript, Python, PHP, HTML, XML, CSS, JSON, Shell, PowerShell, Batch, INI, Markdown, and log files.

IntelliSense

Full autocompletion for the Perception.cx API surface in both AngelScript and Lua. Includes function signatures, parameter hints, type info, and namespace-aware resolution (e.g. sdk::player_t resolves correctly). Trigger manually with Ctrl+Space or let it appear automatically as you type.

Find & Replace

Open with Ctrl+F (find) or Ctrl+H (find & replace). Supports regex, case sensitivity, and whole-word matching. Navigate matches with Enter/Shift+Enter or the arrow buttons.

Line Operations

  • Ctrl+D — Duplicate line or selection

  • Ctrl+/ — Toggle line comment

  • Tab / Shift+Tab — Indent / unindent selection

  • Ctrl+A — Select all

  • Standard clipboard: Ctrl+C, Ctrl+X, Ctrl+V

Undo (Ctrl+Z) and Redo (Ctrl+Y) use coalesced history — fast typing gets grouped into single undo steps.

Font Scaling

Ctrl+Scroll to zoom the editor font in or out.


File Explorer

The left sidebar shows your project's file tree with expand/collapse for folders. Right-click any item to access the context menu:

  • New File — create a file in the selected directory

  • New Folder — create a subdirectory

  • Rename — rename the selected file or folder

  • Delete — remove the selected item

  • AI Root — set or remove the selected folder as an AI Root (see AI Root below)


Script Toolbar

The toolbar across the top of the editor provides one-click access to the script lifecycle:

Button
Action

Execute

Compile and run the current script immediately

Reload

Hot-reload a running script without restarting

Unload

Stop and unload the script cleanly

Verify

Compile-check only (no execution) — shows errors with line numbers

Bundle

Resolve all #include directives into a single merged output file

The Bundle button uses the built-in #include resolver by default. You can replace it with a custom build command using Custom Commands.


Integrated Terminal

A built-in cmd.exe terminal lives at the bottom of the editor. Toggle it with Ctrl+`.

Terminal Tabs

The terminal supports up to 8 independent tabs, each running its own cmd.exe process with a separate output buffer, scroll position, and command history.

  • Click + to open a new tab

  • Click a tab to switch to it

  • Click × on a tab to close it (at least one tab is always kept)

  • Each tab shows a colored status dot: green = alive, red = process exited

Terminal Shortcuts

Key
Action

Ctrl+`

Expand / collapse terminal

Ctrl+L

Clear terminal output

Up / Down

Navigate command history

Ctrl+C

Send interrupt signal to process

Esc

Return keyboard focus to editor

AI integration: When the AI runs shell commands, they always execute in the active terminal tab. You can dedicate one tab for AI operations and keep another for manual commands.


AI Chat

The editor includes a full AI chat panel that connects to any OpenAI-compatible API endpoint — LM Studio, Ollama, OpenRouter, cloud providers, or any service that speaks the standard chat completions format.

Getting Started

  1. Open the Settings sidebar (gear icon)

  2. Under AI Chat, enter your endpoint URL and Model name

  3. Optionally add an API Key

  4. Open the Chat sidebar tab and start typing

You can configure multiple endpoints and switch between them from the dropdown at the top of the chat panel.

Chat Features

  • Streaming responses with real-time token usage display in the header bar

  • Full markdown rendering — headings, bold/italic, inline code, fenced code blocks with syntax highlighting, tables, horizontal rules, lists, and blockquotes

  • Thinking / reasoning — models that output reasoning tokens get collapsible "Thinking" blocks. When collapsed, an auto-generated summary appears (e.g. "Read 3 files, edited 2 files"). Non-thinking models work normally without the thinking block

  • Conversation management — the dropdown menu offers:

    • New Chat — start a fresh conversation

    • History — browse and load previous chat sessions

    • Clear — wipe the current conversation

    • Summarize & Continue — compress older messages to free up context space

  • Auto-compaction — when the conversation exceeds a configurable token threshold, older messages are automatically summarized to stay within context limits. Set the threshold in Settings → Auto-Compact Tokens (0 to disable)

  • Extra system prompt — add your own persistent instructions in the multiline text area at the bottom of the AI Chat settings section. These are injected into every API request

  • Panel positioning — pin the chat panel on the left or right side of the editor via the AI Chat on Right Side checkbox

Stopping a Response

Click Stop or press Ctrl+C while the AI is streaming to cancel immediately. You can then edit your message or send a new one without any issues.


AI Code Fill

Separate from the chat, the editor supports inline AI code completions — similar to Copilot but running on your own model.

  • Triggers automatically after a configurable delay while typing

  • Ghost text appears inline in grey — press Tab to accept, Esc to dismiss

  • Supports FIM (Fill-in-the-Middle) tokens for models like Qwen Coder

  • Uses a separate endpoint, model, and API key from the chat — run a small fast model for completions and a larger model for chat

  • Configurable context window (number of surrounding lines sent to the model)

  • Platform API context is injected automatically so the model knows the Perception.cx API

Code Fill Settings

Setting
Description

Enable Code Fills

Master toggle

URL / Model / API Key

Endpoint for completions (separate from chat)

Max Tokens

Maximum completion length

Trigger Delay (ms)

Idle time before requesting a completion

Context Lines

Number of surrounding code lines to include

Use FIM Tokens

Enable Fill-in-the-Middle token wrapping

FIM Prefix / Suffix / Middle

Custom FIM token strings for your model


AI Tool Use

The AI doesn't just chat — it can take actions. When Enable Tool Calls is checked in settings, the AI has access to 40+ tools and loops automatically until the task is done (up to the configurable Tool Loop Limit).

File & Code Tools

Tool
Description

read_file

Read a file's full contents

read_lines

Read a specific line range

write_file

Write full file contents (shows diff for review)

edit_file

Search/replace edit — old text must match exactly

batch_edit

Apply multiple search/replace edits atomically

replace_all

Find and replace ALL occurrences in a file

create_file

Create a new file (fails if it already exists)

insert_lines

Insert text before a specific line

delete_lines

Delete a range of lines

replace_selection

Replace the current editor selection

search_text

Search across open files

find_references

Search across ALL project files on disk

get_file_info

Get current file info: path, language, lines, cursor, errors

get_open_files

List all open buffers with line counts and modified status

list_files

List directory contents

get_symbols

List function/struct/class/enum definitions in a file

open_file

Open a file in a new editor tab

save_file

Save a file to disk

goto_line

Move cursor to a line number

get_clipboard

Read system clipboard text

get_recent_changes

Get last 20 undo history entries

add_bookmark / get_bookmarks

Manage named bookmarks

check_script

Compile-check a script for errors without executing

validate_script

Compile and optionally run a script

Shell & Automation Tools

Tool
Description

exec_shell_command

Run a command in the active terminal tab (30s timeout)

run_custom_command

Run a user-defined custom command by name

execute_script

Write and run an AngelScript/Lua script on the fly

ask_user

Pause and ask you a question, then resume after you respond

web_search

Search the web via Brave Search API

Diff Review Tools

Tool
Description

get_diff

Get current pending diff state

wait_for_diff_review

Pause until you resolve all pending diffs

Reverse Engineering Tools

Tool
Description

list_processes

List processes with PID, name, base address, EPROCESS

get_process_info

Detailed process info: modules, threads, PEB, DTB

read_memory

Read bytes as hex dump + ASCII (max 4096 bytes)

read_typed_value

Read typed values: uint8–64, float, double, pointer arrays

find_pattern

IDA-style byte pattern scanning with ? wildcards

read_pointer_chain

Follow pointer chain with offsets at each dereference

read_string

Read ASCII or Unicode string from memory

get_module_exports

List exported functions from a module's PE export table

Advanced Tools

These are gated behind the Allow Advanced Writing Tools checkbox in settings:

Tool
Description

memory_write

Write bytes to process memory

scan_string / scan_wstring

Scan process VAD for ASCII/Unicode strings

disassemble

Disassemble x86-64 instructions at an address (Zydis)

delete_file

Permanently delete a file


Diff Review

When the AI edits a file, it doesn't overwrite your code directly. Every change goes through a diff review:

  • Changes are displayed as individual hunks with green (added) / red (removed) highlighting

  • Navigate between hunks with Up / Down arrow keys

  • Enter — accept the focused hunk

  • Delete — reject the focused hunk

  • Ctrl+Shift+A — accept all hunks at once

  • Esc — reject all remaining hunks

The AI can call wait_for_diff_review to pause until you've resolved all pending diffs before it continues. Alternatively, enable Auto-accept AI edits in settings to skip review entirely.


AI Root

AI Root lets you scope where the AI operates within your project. When set, the AI will only read, write, and browse files within the designated folder(s).

Setting an AI Root

  1. In the File Explorer sidebar, right-click any folder

  2. Click AI Root to toggle it on or off

  3. Folders marked as AI Root show a visual indicator in the tree

You can set multiple AI Roots. When at least one is set, the AI's file operations are restricted to those directories. When no AI Roots are set, the AI can access the entire project.

AI Roots persist across sessions and are saved with your editor state.


Custom Commands

Custom Commands let you define named shell commands that integrate into the editor and AI workflow. Define them in Settings → Custom Commands.

Creating a Command

  1. Click + Add Command

  2. Enter a Name (e.g. "Build", "Test", "Deploy")

  3. Enter a Command (e.g. build.bat, python test.py, npm run build)

  4. Optionally check Use as Bundler to replace the toolbar's Bundle button with this command

Bundler Override

When a custom command has Use as Bundler enabled, clicking the Bundle button in the script toolbar will run your custom command in the terminal instead of the built-in #include resolver. Only one command can be the active bundler at a time.

This is useful for custom build pipelines — C-preprocessor macro expansion, hash baking, minification, or any project-specific processing the built-in bundler doesn't cover.

AI Integration

Custom commands are automatically exposed to the AI as the run_custom_command tool. The AI can invoke any of your defined commands by name during agentic workflows. For example, after editing files the AI could run your custom build command to verify compilation.


File Backups & Timeline

Every save creates a timestamped backup. The Timeline sidebar tab lets you browse and compare backups:

  • All backups for the current file are listed, sorted by date

  • Click any backup to open a side-by-side diff view comparing it against the current version

  • Line-level add/remove/change highlighting

  • Configurable max backup count and backup directory in settings

  • Deleted file recovery — the most recent backup of removed files is preserved


Settings

All configuration lives in the Settings sidebar tab (gear icon). Everything persists to disk automatically.

Project

  • Root Directory — your project folder. Set via the text field or by opening a folder

  • AI Root — managed via right-click in the file explorer (see AI Root)

Editor

  • Scroll Speed — mouse wheel scroll multiplier

  • Autoscroll Speed — speed when auto-scrolling during selection drag

Bundler

  • Strip comments from output — remove comments when bundling #include files

AI Chat

Setting
Description

AI Chat on Right Side

Pin the chat panel to the right side of the editor

Auto-accept AI edits

Skip diff review and apply AI changes immediately

Allow Advanced Writing Tools

Enable dangerous tools: memory write, disassemble, delete file, string scan

Include Platform APIs

Inject Perception.cx API documentation into the AI context

Include AngelScript Quick Reference

Inject AngelScript language reference into the AI context

Enable Tool Calls

Allow the AI to use tools (file ops, RE tools, shell, etc.)

URL

API endpoint URL (OpenAI-compatible)

Model

Model name string

API Key

Bearer token for authentication

Tool Loop Limit

Maximum number of consecutive tool call rounds

Temperature

Sampling temperature (0.0–2.0)

Top P

Nucleus sampling threshold

Auto-Compact Tokens

Token count threshold for automatic conversation compaction (0 = disabled)

Brave Search Key

API key for web search tool

Extra System Prompt

Your own persistent instructions appended to every request

Code Fill

See AI Code Fill for details on each setting.

Backups

Setting
Description

Max Backups

Maximum number of backups per file

Backup Directory

Where backup files are stored

Custom Commands

See Custom Commands for details.


Keyboard Shortcuts

Editor

Key
Action

Ctrl+S

Save file

Ctrl+W

Close tab

Ctrl+F

Find

Ctrl+H

Find & Replace

Ctrl+Z

Undo

Ctrl+Y

Redo

Ctrl+D

Duplicate line / selection

Ctrl+/

Toggle comment

Ctrl+Space

Trigger code fill manually

Ctrl+Scroll

Zoom font size

Tab

Accept AI suggestion / Indent

Esc

Dismiss AI suggestion / Close find

Diff Review

Key
Action

Enter

Accept hunk

Delete

Reject hunk

Up / Down

Navigate between hunks

Ctrl+Shift+A

Accept all hunks

Esc

Reject all hunks

Chat

Key
Action

Enter

Send message

Shift+Enter

New line in message

Ctrl+C

Cancel AI stream

Terminal

Key
Action

Ctrl+`

Expand / collapse terminal

Ctrl+L

Clear terminal output

Up / Down

Command history

Ctrl+C

Send interrupt to process

Esc

Return focus to editor

Last updated