Hey Everyone! I’ve been experimenting with OpenCode + BoneScript for structured backend generation.
Posted by Glittering_Focus1538@reddit | LocalLLaMA | View on Reddit | 13 comments
I’ve been experimenting with making coding agents generate complete backends using BoneScript, and it’s working surprisingly well.
BoneScript’s structure ends up being extremely LLM-friendly:
- declarative system layout
- predictable architecture
- explicit entities/capabilities/routes
- less ambiguity than raw backend frameworks
So I built an OpenCode plugin/backend integration that pushes agents toward generating BoneScript instead of ad-hoc backend code.
The result is that the model tends to:
- stay architecturally consistent longer
- make fewer structural mistakes
- generate cleaner backend flows
- reason about systems at a higher level instead of individual files
Project:
opencode-bonescript-backend | npm package
I’d genuinely love feedback from people building agentic coding tools or experimenting with LLM-native development workflows.
fuckable-switcher@reddit
What is bone script?
It seems really cool
Glittering_Focus1538@reddit (OP)
BoneScript is a TypeScript DSL and Compiler for backend development, designed to let you define backend systems in a declarative, domain-oriented format that compiles into working application code and infrastructure artifacts.
It introduces a higher-level abstraction over traditional backend code by separating concerns into structured primitives like
system,entity, andcapability, where each maps to core backend concepts such as domain boundaries, data models, and executable business logic workflows.heres an example .bone file
system DeliveryTest {
domain: marketplace
entity Driver {
owns: [name: string, capacity: uint, current_load: uint]
}
entity Order {
owns: [pickup: string, dropoff: string, weight: uint, status: string]
}
capability fulfill_order(order: Order) {
requires: [order.status == "pending"]
pipeline: {
validate_order(order)
reserve_inventory(order) as reservation
assign_driver(order) as assignment
notify_customer(order, assignment)
on_error: rollback
}
sync: transactional
timeout: 30s
}
capability find_route(start_node: string, end_node: string) {
algorithm: shortest_path using {
graph: road_network,
source: start_node,
target: end_node
}
returns: json
sync: eventual
idempotent: true
}
}
You would compile that and it would generate the files needed, meaning the DSL is transformed into a structured backend implementation. This includes generating the underlying TypeScript service logic, data schemas for entities, validation rules derived from
requiresclauses, and orchestration logic forpipelineblocks as executable workflows. Each capability is compiled into a deterministic execution unit, where step ordering, error handling (on_error), and execution guarantees (sync: transactionalvssync: eventual) are preserved in the generated runtime behavior.Entities become typed data models with enforced ownership structures, while capabilities become callable backend operations with clearly defined inputs, outputs, and execution semantics. Pipeline steps are treated as discrete operations that are composed into a dependency graph, allowing the compiler to manage execution flow, intermediate results (like
as reservation), and rollback behavior when failures occur.In practice, this allows backend systems to be defined at a higher level of abstraction while still compiling down into fully functional backend services with predictable execution semantics.
fuckable-switcher@reddit
Okay as much as I hate to be a prick
You seem like you know a lot
That made sense in the way it was worded
But I couldn’t understand that
Could you please try to dumb that down?
Glittering_Focus1538@reddit (OP)
Basically, BoneScript is just a way to describe backend systems in a simpler, more structured format instead of writing all the code manually.
You define:
For each action, you don’t write raw backend code first. Instead, you describe the steps in plain structure:
requires)pipeline)on_error)Then a compiler takes all of that and generates the actual backend code for you (APIs, service logic, data models, and workflow handling).
So in simpler terms:
BoneScript is basically a way to write “what your backend should do” in a structured format, and then have the computer generate the real backend code from that automatically.
fuckable-switcher@reddit
Yeah right
Glittering_Focus1538@reddit (OP)
?
fuckable-switcher@reddit
Sorry that made more sense now I kinda grasp it
I didn’t mean to come off as a git
That’s just a be thing saying “yeah right” for lack of better words
Sorry
Glittering_Focus1538@reddit (OP)
no ur good, I recomend using it in opencode as it sits, the plugin should allow you to watch your LLM work through it and produce working code in a fraction of the time.
fuckable-switcher@reddit
Yeah okay I’ll try that
I’m working on a plugin at the money that uses a private GitHub repo for memory across multiple instances or whatever of open code so you can connect chats sessions secrets keys memory persona whatever into it and then you just do some magic (yet to figure that bit out) then any machine running open code can access that
Obviously you’d want it to be your repo and a private GitHub repo
Idk if that made sense
I’m still working on it
Glittering_Focus1538@reddit (OP)
Yeah I get it, kinda like a custom RAG memory just for chat context across multiple conversation like what chatgpt does
Glittering_Focus1538@reddit (OP)
BoneScript is a TypeScript DSL and Compiler for backend development, designed to let you define backend systems in a declarative, domain-oriented format that compiles into working application code and infrastructure artifacts.
It introduces a higher-level abstraction over traditional backend code by separating concerns into structured primitives like
system,entity, andcapability, where each maps to core backend concepts such as domain boundaries, data models, and executable business logic workflows.heres an example .bone file
system DeliveryTest {
domain: marketplace
entity Driver {
owns: [name: string, capacity: uint, current_load: uint]
}
entity Order {
owns: [pickup: string, dropoff: string, weight: uint, status: string]
}
capability fulfill_order(order: Order) {
requires: [order.status == "pending"]
pipeline: {
validate_order(order)
reserve_inventory(order) as reservation
assign_driver(order) as assignment
notify_customer(order, assignment)
on_error: rollback
}
sync: transactional
timeout: 30s
}
capability find_route(start_node: string, end_node: string) {
algorithm: shortest_path using {
graph: road_network,
source: start_node,
target: end_node
}
returns: json
sync: eventual
idempotent: true
}
}
You would compile that and it would generate the files needed, meaning the DSL is transformed into a structured backend implementation. This includes generating the underlying TypeScript service logic, data schemas for entities, validation rules derived from
requiresclauses, and orchestration logic forpipelineblocks as executable workflows. Each capability is compiled into a deterministic execution unit, where step ordering, error handling (on_error), and execution guarantees (sync: transactionalvssync: eventual) are preserved in the generated runtime behavior.Entities become typed data models with enforced ownership structures, while capabilities become callable backend operations with clearly defined inputs, outputs, and execution semantics. Pipeline steps are treated as discrete operations that are composed into a dependency graph, allowing the compiler to manage execution flow, intermediate results (like
as reservation), and rollback behavior when failures occur.In practice, this allows backend systems to be defined at a higher level of abstraction while still compiling down into fully functional backend services with predictable execution semantics.
Ok-Ask1962@reddit
The issue with LLM-native tools is that too much abstraction kills control. The explicit BoneScript approach feels more tractable ngl.
Glittering_Focus1538@reddit (OP)
Not only that, but it's easy for LLM's to use so they make higher quality code with less security nightmares.