跳到正文
DEV Community· Piyush Annigeri·· 3 小時前AI 評分42

GHOSTLINE:具備記憶功能的終端

GHOSTLINE — The Terminal That Remembers

AI 導讀

GHOSTLINE 是以 Python 開發的本機優先 AI 終端助手,使用 Ollama 在本機執行 Qwen3(8B),並以 JSONL 保存跨工作階段的對話記憶。用戶可在終端與 AI 對話、執行指令及匯出 Markdown;指令只會在用戶明確要求時執行。模型下載後,GHOSTLINE 可離線使用,對話資料亦可留在用戶的裝置上。

正文

GHOSTLINE 👻 — The Terminal That Remembers

This is a submission for the Hacktoberfest Open-Source AI Challenge Week 4: Ghost in the Machine

What I Built

What if your terminal remembered everything you told it, understood your mistakes, and occasionally whispered back?

Meet GHOSTLINE — The Terminal That Remembers.

GHOSTLINE is a local-first AI-powered terminal companion designed to make developer workflows more interactive, intelligent, and a little spooky.

Inspired by the idea of a ghost living inside an old computer, I wanted to build something that brings the Halloween theme to life while solving a real developer problem: understanding terminal commands, debugging errors, and retaining context across interactions.

Instead of building another web-based chatbot, I decided to bring AI directly into the terminal.

With GHOSTLINE, you can:

  • Have conversations with an AI assistant directly from your terminal.
  • Ask questions about programming, debugging, and development.
  • Explicitly execute terminal commands and let AI interpret their output.
  • Maintain persistent conversation memory across sessions.
  • Export conversations into Markdown for future reference.
  • Run AI inference locally using an open-weight model.
  • Use the application without an internet connection after the model has been downloaded.

GHOSTLINE is designed around one important principle:

Your terminal activity should remain yours.

It doesn't automatically monitor your shell or execute commands behind your back. You decide what information to share and which commands to run.

Demo


ghostline --demo

For the actual AI-powered experience, install Ollama and download the model:

ollama pull qwen3:8b
python -m pip install .
ghostline

The demo mode demonstrates the interaction flow, while the live application uses local model inference.

Code

GitHub Repository: https://github.com/pixelcrisscross/GHOSTLINE.git

The project is built with Python and uses a modular architecture.

Key components include:

  • ghostline/cli.py — Interactive terminal interface, command handling, safety prompts, and session management.
  • ghostline/core.py — Local model communication, conversation memory, and Markdown export.
  • tests/ — Unit tests for memory management, export functionality, and command safety checks.

The repository also includes installation instructions, configuration options, and an MIT License.

How I Built It

I wanted GHOSTLINE to be more than a themed interface around a closed AI API. The AI itself needed to be a core part of the application.

Technology stack:

  • Python: Core application and terminal interface.
  • Ollama: Local model serving and inference.
  • Qwen3 (8B): Default open-weight language model.
  • JSONL: Persistent, locally stored conversation memory.
  • HTTP API: Communication between the Python application and the local Ollama server.

Architecture

The application follows a straightforward architecture:

             DEVELOPER
                 |
                 v
          GHOSTLINE CLI
                 |
          +------+------+
          |             |
          v             v
     Local Memory   Command Runner
       (JSONL)           |
          |              v
          |         Command Output
          |              |
          +-------+------+
                  |
                  v
             Ollama API
           localhost:11434
                  |
                  v
            Qwen3 8B Model
                  |
                  v
          Contextual Response
                  |
                  v
              GHOSTLINE

The application communicates with Ollama through its local HTTP API.

Conversation history is stored in JSONL format, allowing the application to retain context without requiring an external database.

One of the important design decisions was keeping command execution explicit. Normal conversations never execute shell commands. The developer must use the :run command to execute something.

I also implemented confirmation prompts for commonly recognized destructive commands.

The application includes a demo mode, allowing someone to explore its interface without downloading a model.

Why Does Open Innovation Matter?

This is probably the most important part of GHOSTLINE.

Terminal interactions can contain sensitive information: directory structures, project details, command output, error logs, and sometimes accidental exposure of credentials.

Building GHOSTLINE around local inference changes how that information is handled.

Using an open-weight model through Ollama gives us several advantages:

1. Privacy and control

Conversation context and command output can remain on the developer's machine instead of being sent to a third-party hosted AI API.

2. Offline capability

Once the model is downloaded, GHOSTLINE can continue performing local inference without an active internet connection.

3. Model independence

The application is not permanently tied to one proprietary model provider. Developers can change the model through configuration.

4. Transparency

Conversation memory is stored in a readable JSONL file. Developers can inspect, export, and delete their own data.

5. Accessibility

There is no mandatory per-request cloud inference fee. The trade-off is that inference depends on the user's available hardware.

For me, open innovation means more than having access to source code.

It means having the freedom to understand, modify, run, and control the intelligence behind the software we build.

My Agent Session

The current version does not yet have a recorded DevRelay session.

I plan to add an actual development session showing the architecture, local model integration, memory implementation, and debugging process.

The Spirit of It

Halloween has always been associated with haunted houses, mysterious voices, and things that refuse to disappear.

I wanted to bring that feeling into something developers interact with every day.

Imagine opening a dark terminal.

A familiar green glow appears.

A machine wakes up.

You ask it a question.

And something answers.

But beneath the Halloween aesthetic is a more meaningful idea: software should not have to forget everything when you close a window, and intelligent tools should not require you to surrender control of your data.

GHOSTLINE is my interpretation of the Ghost in the Machine.

Some machines execute commands. Some machines remember.

This one does both — but only when you ask.

Prize Categories

Primary submission:

  • Overall Hacktoberfest Open-Source AI Challenge Winner.

Built with curiosity, Python, open-weight AI, and a little Halloween spirit. 👻

devchallenge #hf26challenge #hacktoberfest #opensource #AI #Python #Ollama #Qwen

來源:DEV Community · dev.to