林子豪的 PKM

Blog

nrepl-starter 与 Tenx:把 REPL 接进运行中的 Java JVM

nrepl-starter 在 Java 应用内部启动 Clojure nREPL,Tenx 再把 IDEA 里的方法调用转成 REPL 表达式,让复杂测试数据准备和运行时调试从半小时缩短到秒级。

clojurejavanreplintellijdeveloper-tools
nrepl-starter4 min read
re-dash:ClojureDart 里的单向数据流

Flutter 的状态管理可以离开模拟器测试。re-dash 把 re-frame 的六个 domino 搬进 ClojureDart:view 是纯函数,用户行为是数据。

5 min read
Hex Grid 的坐标是怎么工作的?

从 War Chest 的棋盘出发,用 cube coordinates 的三维切面理解 axial coordinates、六个邻居以及 hex distance。

game-developmenthex-gridmathematicsvisualization
game-ai6 min read
用 Hex Grid Primitives 组合 War Chest 规则

把距离、直线、路径与阻挡拆成可组合的几何 primitive,再用它们表达弓箭手、弩手等 War Chest 单位规则。

game-developmenthex-gridclojurewar-chest
war-chest25 min read
把任务交给 AI Agent 之前,先定位任务坐标

从第一性原理出发理解 agent:读完以后,你能把 AGENTS.md、skill、plan mode、goal mode、subagent、handoff、guardrail 等概念放回同一套任务坐标里。

aiagentcontextworkflow
agent30 min read
AlphaZero 的搜索:MCTS

How Monte Carlo Tree Search connects game states, legal moves, policy priors, and value estimates.

alphazeromctssearchdraughts
game-ai8 min read
Bitboard Method

Interactive notes for learning bitboard board representation.

bitboarddraughts
game-ai8 min read
Skill 不只是能力包,也是 taste profile

读 SkillOpt 论文后的一个想法:通用任务可以训练公共 best_skill,但写作和人文类 skill 更像个人 taste profile,选 skill 本质上是在选一种审美和工作方式。

aiagentskillwritingevaluation
agent5 min read
理解是投影,不是翻译

从《降临》的外星文字出发,思考语言如何把高维语义关系投影成人类可以处理的表达。

languageaithinking
3 min read
Agent 是一套运行系统

Agent 不是单个模型,而是围绕模型组织目标、上下文、工具、记忆、权限、验证和控制循环的一套运行系统。

aiagentruntime
agent2 min read
Context 组装不是拼聊天记录

Context assembly 的目标不是把历史对话依次拼接,而是为当前任务构造一个清楚、有层级、有证据的工作视图。

aiagentcontext
context2 min read
Intentional Compaction 和 Stage Gate

长任务不一定要让 agent 一口气跑到底。把关键中间结果写成结构化文档,本身就是一种受控压缩和人工纠偏机制。

aiagentworkflow
context2 min read
LLM 不是 Agent

LLM 可以先理解成一个根据当前输入继续生成 token 的语言引擎。Agent 则是把模型、上下文、工具、记忆、权限和运行循环组织起来的系统。

aiagentllm
agent2 min read
Memory 不是 Context

Memory 是外部保存、可被取回的信息;context 是当前这一轮真正放进模型窗口的材料。把两者分开,才能设计清楚 agent 的记忆机制。

aiagentmemory
context2 min read
从自然语言到 Tool Call

Agent 并不是直接用自然语言操作世界,而是把人的意图翻译成结构化工具调用,再由 runtime 做确定性执行。

aiagenttools
agent2 min read
权限也是 Context 的一部分

Agent 能看到什么,本身就是权限问题。Context 管理不能只考虑相关性,也必须考虑可见性、来源边界和派生数据权限。

aiagentsecurity
context2 min read
Smart Read Layer

Agent 说“读这个文件”时,runtime 不一定要把原始字节流直接塞给模型。读操作可以先经过类型感知、可追溯、可展开的处理层。

aiagentcontext
2 min read
Subagent 首先是 Context Isolation

Subagent 不只是并行执行任务的工具,更重要的是给局部问题创建隔离的上下文、权限和工作区。

aiagentcontext
agent2 min read
Context 是模型这一轮能看到的材料

Context 不是所有历史,也不是所有资料,而是当前这一轮真正进入模型窗口的材料。理解 context,才能理解 agent 为什么需要管理、压缩和选择信息。

aiagentcontext
context3 min read
为什么要管理 Context

Context 管理的目标不是把更多资料塞给模型,而是在有限窗口里让模型看到更相关、更清楚、更可执行的材料。

aiagentcontext
context3 min read
先点亮地标

新概念往往不是线性出现的,而是网状地互相牵连。学习它们时,先有大致位置感,再慢慢补充细节,是很自然的过程。

learningknowledgeai
2 min read
如何用 AI 学习

在保留必要难度的前提下,用 AI 消解不必要难度、调节练习强度与广度,用 AI 做辅助而非代劳

learningai
4 min read
Guardrail 的必要性

长时间运行的 agent 任务必须有明确的 guardrail,否则容易跑偏、浪费 token、增加人类 review 成本。

agentaisystem-design
agent1 min read
Agent 自主性:如何划分决策边界

探讨 AI agent 的自主性 spectrum,讨论 agent 如何判断哪些决策应该自己做,哪些应该由用户来做

agentaidecision-making
agent8 min read
Agent 如何帮助人类发现问题

通过提问机制和 zettelkasten 知识组织,让 agent 帮助人类发现和解决问题

agentaiknowledge-management
agent2 min read
AI Eval System - 引言

AI Eval System 是用来系统性地测试和评估 AI 系统质量的框架。本文介绍了 Eval System 的核心问题、传统方法的局限,以及如何用 GTD 范式来构建这样的系统。

toolingaievaluation
ai-eval2 min read
AI Eval System - 打分系统

在构建 AI Eval System 时,打分逻辑应该优先使用确定性方法(linter、type checker)。本文讨论了 LLM as judge 的递归问题和不确定性叠加,以及为什么确定性评分方法更具优势。

toolingaievaluationlinter
ai-eval4 min read
Clojure Malli + clj-kondo Type Export 实践

给 Clojure 库添加类型导出,让依赖方获得 clj-kondo 静态类型检查。本文记录了使用 Malli schema 定义类型、导出给 clj-kondo 的完整流程,以及路径配置的陷阱和解决方案。

clojurelinter
2 min read
强类型 vs 动态类型:AI 生成代码的思考

强类型语言的编译器能做检查,是否意味着 AI 生成代码更有优势?本文探讨了类型表达力、类型体操成本、编译期 vs 运行期验证,以及动态类型语言在 AI 生成场景下的灵活优势。

type-systemaiclojurerusthaskellsoftware-engineering
4 min read
Finding Fulfillment at Work

Exploration of common workplace dissatisfaction factors and practical approaches to enhance career fulfillment.

careerhappiness
1 min read
Strategies for Effortless and Impactful Writing

Discover practical techniques to make writing easier and more effective, including leveraging AI tools, personal note-taking systems, and identity-based habit formation for a more productive writing process.

writing
writing3 min read
RocketMQ 磁盘满处理方式

An explanation of how RocketMQ handles disk full scenarios, including the error message, relevant source code, and the disk space checking mechanism.

rocketmq
rocketmq1 min read
The Benefits and Challenges of Shadowing

An exploration of shadowing as a language learning technique, discussing its effectiveness at different proficiency levels and providing practical tips for maximizing its benefits.

language
2 min read
学习印尼语一个月总结

A summary of my experience learning Indonesian in one month, discussing the challenges and achievements, and providing insights into the learning process.

language
1 min read
博客使用的技术栈

An overview of the technologies and tools used to create this blog, including Astro, MDX, React, Tailwind CSS, and more.

astro
2 min read
全链路追踪的各种概念

An overview of distributed tracing concepts, including traces, spans, and contexts, with a focus on OpenTracing standards and their applications in system monitoring and debugging.

distributed-system
distributed-systems2 min read
用 MessageChannel 和 iframe 通信

An explanation of how to use MessageChannel for bidirectional communication between a parent page and an iframe, with code examples and step-by-step instructions.

javascript
2 min read
用clojure写个编译器, part1

A tutorial series on building a compiler in Clojure, starting with simple arithmetic expressions and progressing to more complex language features, including AST visualization and compilation to stack-based VM instructions.

clojurecompiler
4 min read
充分利用 Scala 强类型:给 ID 类型加上 tag

当多个实体 ID 都用 String 表示时,编译器无法阻止误传。用 tagged type 和 phantom type 可以把这类约束加入类型系统,而不改变运行时表示。

scalatype-systemformal-methodsfunctional-programming
3 min read
Lens part1 - Iso

An introduction to Iso, a type of lens in functional programming that represents isomorphisms between types. The post explains the concept, provides code examples in Scala, and demonstrates practical applications of Iso in handling unit conversions.

functional-programmingscala
fp1 min read
free functor/monad

An exploration of natural transformations between functors in functional programming, introducing the concept of Free functors and demonstrating how to implement conversions between different container types like Monix Task, Scala Future, and Java CompletableFuture.

functional-programmingscala
fp2 min read
out of core sorting, rust实现

A Rust implementation of out-of-core sorting algorithm, demonstrating how to handle datasets larger than available memory. This post covers the basic concepts of out-of-core sorting, explains the phased approach, and provides a step-by-step implementation in Rust, focusing on disk I/O operations and memory management.

rust
1 min read
string search algorithm #1: 暴力枚举和Boyer–Moore算法

An introduction to string search algorithms, focusing on the naive brute-force approach and the Boyer-Moore algorithm. This post explains the basic concepts, implementation details, and efficiency improvements of these methods for finding substrings within larger text.

algorithm
1 min read
Profunctor

An introduction to profunctors in functional programming, explaining their definition, relationship to bifunctors, and implementation in Scala. This post covers the basic structure of profunctors, their laws, and provides examples of profunctor instances like function types.

functional-programmingscala
fp1 min read
map reduce

An overview of the MapReduce distributed computing model based on the original Google paper. This post covers the MapReduce workflow, master-worker architecture, fault tolerance mechanisms, and optimization techniques like data locality and backup tasks. It also addresses common questions about task granularity and failure handling in MapReduce systems.

distributed-system
distributed-systems1 min read
at most once

An explanation of how to implement at-most-once semantics in distributed systems, covering client-side XID usage, server-side result caching, and strategies for cache management and handling concurrent requests.

distributed-system
distributed-systems1 min read
polymorphic function value 2

An exploration of polymorphic function values in Scala, focusing on natural transformations. This post discusses the limitations of standard Scala function values and introduces a more flexible approach for handling polymorphic functions, particularly useful for operations on heterogeneous lists (HLists).

scala
fp5 min read
sort/hash超出内存大小如何处理

An overview of out-of-core sorting and hashing techniques for handling datasets larger than available memory. This post explains buffer usage, the process of external sorting with multiple passes, and partitioning strategies for out-of-core hashing, including analysis of memory requirements and data size limitations.

database
3 min read
applicative functor

An introduction to applicative functors in functional programming, explaining their definition, methods, and properties with Scala code examples. The post covers the ap and pure methods, as well as the product-based definition of applicatives.

scalafunctional-programming
fp1 min read
lens,函数式的getter和setter

An introduction to lenses in functional programming, explaining how they serve as functional equivalents to getters and setters in object-oriented programming, with code examples in Scala.

functional-programmingscala
fp2 min read
Kleisli

An introduction to Kleisli arrows in functional programming, explaining how they enable composition of functions that return monadic values. The post covers the concept of Kleisli composition, its implementation in Cats, and provides examples using the Writer monad.

functional-programmingscala
fp1 min read
Contravariant Functor Intuition

An exploration of contravariant functors in functional programming, explaining their definition, intuition, and practical applications. The post covers the contramap function, compares it with covariant functors, and provides examples using Show and Ordering types in Scala.

scalafunctional-programming
fp3 min read
交换机,路由器等硬件

An overview of networking hardware including hubs, switches, and routers, along with traffic classification and packet capture techniques. This post explores the differences between these devices, their roles in network communication, and methods for monitoring network traffic.

networking
1 min read
fault tolerence vm

An analysis of fault-tolerant virtual machine replication techniques, discussing primary-backup architectures, deterministic replay, output consistency, and failure detection mechanisms. The post also compares these approaches with log replication in the Raft consensus algorithm.

distributed-system
2 min read
GFS

An analysis of the Google File System (GFS) architecture, discussing its design assumptions, chunk-based storage, metadata management, and consistency model. The post explores the benefits and drawbacks of large chunk sizes, the role of the master server, and the system's approach to data mutations and consistency.

distributed-system
distributed-systems2 min read
raft

An overview of the Raft consensus algorithm, explaining its key components including leader election and log replication. This post covers the basics of how Raft ensures consistency across distributed systems, handles network partitions, and maintains a replicated state machine.

distributed-system
distributed-systems3 min read
网络协议七层模型

An overview of the OSI and TCP/IP network models, explaining the functions of each layer and how they interact. This post also covers network topologies and protocols like CSMA and token ring used in bus networks.

networking
3 min read
数据库的储存方式

An overview of database storage methods, including log-structured storage, indexing techniques, Sorted String Tables (SSTs), and B-trees. The post explores the advantages of each approach and discusses optimizations for improved performance and reliability.

database
2 min read
clojure as framework

表达力强的语言对框架的需求就少,Clojure 本身可作为框架,通过 interop 接入 JVM、ClojureScript 接入 JS/Node、libpython-clj 接入 Python 等多元生态。

clojuresoftware-engineering
1 min read
database instead of file system

延续 static site generator 的思路,讨论 render 基于数据库而非文件系统的优点:更好的查询能力、无需 ship db、数据由 ingest 生成故无同步问题,可类比 IDE 与 hledger 的架构。

clojuresoftware-engineering
1 min read
nix
nix
2 min read
static site generator

讨论在静态站点生成器中引入数据库环节的好处:代码复用、强大查询能力、类型安全、可扩展性和更佳的开发体验。

clojuresoftware-engineering
1 min read
可复用的 UI 代码

讨论如何通过引入 IR 中间表示层组织 UI 代码,实现业务逻辑可测试、渲染后端可替换、布局算法可复用,适用于 DOM、Mobile、游戏引擎等多个平台。

designuisoftware-engineering
3 min read