Skip to content
hcchengithubPublic

About

Forth kernels written in JavaScript and Python.

Topics

Resources

Stars

28 stars

Watchers

1 watching

Forks

Latest commit

 

History

53 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Project K — From a Minimal Kernel to a New Forth System

Project K began as a small Forth kernel implemented in JavaScript and Python. The original project is preserved as V1. It is frozen: its code remains available as a record of the original work, while development moves forward in a new V2 history.

Why V2

I had long wanted to improve my Python implementation. With today's AI tools—and especially the arrival of GPT-6.1—OpenAI encouraged me to experiment, so I asked AI to help reconstruct a specification from the existing work, then build a new implementation from that specification.

The result surprised me. The new implementation follows the same project purpose, yet the ideas, techniques, and realization produced from the specification are far beyond what I had achieved before. This repository is where I am exploring that result: first in Python, and now also in JavaScript.

V2 begins from a clean, orphaned Git history. It does not carry the V1 source into its working tree; V1 remains preserved separately.

Project structure

The conceptual specification describes Project K independently of its implementation language. Each language directory has its own implementation guide.

AI Integration

Project K adheres to the "AI Outside the Kernel" principle: the kernel (projectk.py) remains 100% pure and self-contained with zero AI dependencies.

In Project K 2.1.0, AI integration is officially provided as a minimal host extension:

  • Specifications: See docs/project-k-ai-conceptual-spec.md and py/docs/task-security-spec.md.
  • Interactive Environment: Run python main.py in the py/ directory to enter the Forth REPL with ai: and (ai) support.
  • Safety Boundary: Leverages Project K's cooperative Task pause/resume mechanism for step-by-step review and task-level approval (trust-task resume).

For a broader, application-rich environment built on Project K, see also peforth v2.


Project K — 從精簡 Kernel 出發,打造新一代 Forth 系統

Project K 原本是一個以 JavaScript 和 Python 實作的 Forth kernel。原有成果保留為 V1,並凍結在原來的歷史中;後續開發從新的 V2 開始。

為什麼做 V2

我一直對自己以前的 Python 功力不太滿意。現在有了強大的 AI,尤其 GPT-6.1 出現後,OpenAI 鼓勵我試著用 AI 做點不一樣的事。我請 AI 從既有成果倒推出一份 SPEC,再依照 SPEC 打造新的實作。

結果讓我非常驚喜:前後做的是同一個 Project K,但 AI 按照 SPEC 寫出的成果,在觀念、技巧和理想的實現上,都遠遠超過我以前的作品。V2 就是我探索這份新成果的地方:先完成了 Python,現在也加入了 JavaScript 的實作。

V2 從全新的 orphan branch 歷史開始,工作樹不帶入 V1 的原始程式;V1 則獨立保留。

專案結構

Conceptual SPEC 描述的是 Project K 本身,不綁定 Python 或 JavaScript;各語言目錄則各自說明該語言的實作。

AI 整合

Project K 堅守 「核心純粹 (AI Outside the Kernel)」 原則:核心(projectk.py)本身維持極簡、零 AI 依賴。

自 Project K 2.1.0 起,系統正式提供標準的宿主 AI 擴充層:

  • 規格文件:參見 docs/project-k-ai-conceptual-spec.md 與 py/docs/task-security-spec.md。
  • 互動環境:在 py/ 目錄下執行 python main.py,即可進入具備 ai: 與 (ai) 支援的 Forth REPL。
  • 安全邊界:善用 Project K 原生的 Task pause/resume 機制,提供單步審核與任務信任(trust-task resume)的安全防護。

如需更全面、具備豐富應用工具的 AI Forth 系統,亦可參考 peforth v2。

About

Forth kernels written in JavaScript and Python.

Topics

Resources

Stars

28 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages