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

The workspace root directory is used as the AI's working directory. All relative paths in AI tool calls resolve from this root. Internal directories (chats/, backups/, fonts/) are automatically hidden from AI context and search results.


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 can take actions through tools that are organized into categories. Each category can be individually enabled or disabled in Settings → AI Chat → Tools. The AI loops automatically until the task is done (up to the configurable Tool Loop Limit).

Read / Browse Tools

Tool
Description

read_file

Read a file's full contents

read_lines

Read a specific line range

list_files

List directory contents

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

get_symbols

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

open_file

Open a file in a new editor tab

create_file

Create a new file (fails if it already exists)

save_file

Save a file to disk

get_clipboard

Read system clipboard text

get_recent_changes

Get last 20 undo history entries

Write / Edit Tools

Tool
Description

edit_file

Search/replace edit — old text must match exactly

write_file

Write full file contents (shows diff for review)

batch_edit

Apply multiple search/replace edits atomically

replace_all

Find and replace ALL occurrences in a file

insert_lines

Insert text before a specific line

delete_lines

Delete a range of lines

replace_selection

Replace the current editor selection

goto_line

Move cursor to a line number

add_bookmark / get_bookmarks

Manage named bookmarks

get_diff

Get current pending diff state

wait_for_diff_review

Pause until you resolve all pending diffs

Execution 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 (see Custom Commands)

check_script

Compile-check a script for errors without executing

validate_script

Compile and optionally run a script

execute_script

Write and run an AngelScript/Lua script on the fly

Memory / RE 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

Web Search Tool

Tool
Description

web_search

Search the web via Brave Search API (requires Brave Search Key)

General Tools (always available)

Tool
Description

echo

Echo text (testing)

status

Show progress/status message to the user

ask_user

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

Advanced Tools

These require the Advanced (delete, write mem, scan) toggle to be enabled in the Tools section:

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.


Custom Commands

Custom Commands let you define named shell command sequences 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. Optionally set a Shortcut keybind — click the shortcut field and press your desired key combination

  4. Add one or more Steps — each step is a shell command (e.g. build.bat, python test.py). Multiple steps are chained with &&

  5. Optionally fill in the AI Context field to describe what the command does for the AI

AI Context

The AI Context field tells the AI what your command does. When this field is filled in, the command becomes available to the AI as the run_custom_command tool. Leave it empty to keep the command manual-only.

For example, a "Build" command with AI Context set to "Compiles the project and reports errors" will let the AI run your build after editing files to verify compilation.

Shortcut Keybinds

Each command can have a keyboard shortcut. Click the shortcut field in settings and press your desired key combination (e.g. Ctrl+B). Click "Clear" to remove a keybind. Shortcuts work globally while the editor has focus.

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.


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

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

Enable Prompt Caching

Use prompt caching to reduce token costs on OpenRouter / Anthropic

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

References

Controls what context documentation is injected into AI requests. Found under AI Chat settings.

Setting
Description

Platform APIs

Inject Perception.cx API documentation into the AI context

AngelScript Quick Reference

Inject AngelScript language reference into the AI context

.md Documentation

Inject .md files from the current file's directory and any open .md tabs

Tools

Controls which tool categories the AI can use. Found under AI Chat settings. Disabling a category removes those tools from the AI entirely, saving tokens.

Setting
Description

Read / Browse

File reading, directory listing, search, symbols

Write / Edit

File editing, diffs, bookmarks, line operations

Execution

Shell commands, custom commands, script compile/run

Memory / RE

Process info, memory read, patterns, disassemble

Web Search

Web search via Brave API (also requires Brave Search Key)

Advanced (delete, write mem, scan)

Dangerous tools: memory write, file delete, string scan, disassemble

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