Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions docs/telos-goal-module.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Telos goal module (`lib_telos_goals.metta`) — optional

OmegaClaw is goal-autonomous but the public core ships no dedicated, inspectable model of
*what the goals are* (no `goal` token in `run.metta` / `lib_omegaclaw.metta`). This optional
module adds one in OmegaClaw's own idiom: AtomSpace atoms + parameterized derivation rules.

It is **opt-in** and **side-effect-free on load** (nothing runs at import).

## Schema

```
(goal <id> <scope> <owner> <status>) ; scope: individual | collective
; status: active | proposed | achieved | abandoned
(rel <type> <src> <dst>) ; type: supports | conflicts | subsumes | depends-on
```

## Use

Load it, then have the agent assert goal/rel atoms it inferred from what it is reading and

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you clarify the intended integration here? The module defines the representation and queries, but OmegaClaw doesn’t currently infer or assert goal / rel atoms on its own.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct: Omega does not infer or assert goal / rel atoms on its own, and the doc now leads with that instead of leaving it implied. The intended path is the LLM layer asserting them through the existing metta skill (metta (add-atom &self (goal ...))) and reading them back the same way. To make that concrete, the module now ships (telos-enable), which uses the core add-prompt-extension hook from src/skills.metta to install a GOAL GRAPH prompt section describing the schema, the add-atom calls, the read lenses, and the rule that every conflict-between / blocked result is surfaced to the user before acting on a goal. (telos-disable) removes it. Still opt-in and still nothing runs at import. The enable/disable round trip through getPromptExtensions is tested. The doc moved to docs/reference-lib-telos-goals.md to match the reference-* convention and is linked from docs/README.md.

call the rules via the `metta` skill:

```metta
!(import! &self (library OmegaClaw-Core lib_telos_goals))

(goal alice-train individual alice active)
(goal dao-fair-access collective dao active)
(rel conflicts alice-train dao-fair-access)

!(telos-conflicts) ; -> (conflict-between alice-train dao-fair-access)
!(telos-collective-goals) ; -> (collective-goal dao-fair-access dao)
!(telos-reading) ; all lenses at once
```

Rules available: `telos-conflicts`, `telos-collective-goals`, `telos-goals-of`,
`telos-achieved`, `telos-blocked`, `telos-aligned`, `telos-reading`.

## Verified

Loads on the standalone Hyperon interpreter and in a **live OmegaClaw (PeTTa) runtime** — the
conflict rule derives `(conflict-between alice-train dao-fair-access)` inside the running
agent's AtomSpace.

## Why / measuring it

Goal *misunderstanding* (pursuing the literal request and missing the real goal, serving one
person while externalising cost onto the group, chasing an abandoned goal) is where an
autonomous agent is most dangerous and is rarely measured. This module is paired with a
14-scenario / 7-category goal-understanding **benchmark** that can score OmegaClaw or any
agent: https://github.com/arielagor/telos (MIT, same licence as OmegaClaw). Contributed from
the BGI Sprint I project "Telos".
63 changes: 63 additions & 0 deletions lib_telos_goals.metta
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
; ============================================================================
; lib_telos_goals — an optional goal-representation module for OmegaClaw
; ----------------------------------------------------------------------------
; OmegaClaw is goal-autonomous (it creates goals, pursues them, tracks progress),
; but the public core ships no dedicated, inspectable model of *what the goals are*:
; a grep of this repo finds no `goal` token in run.metta / lib_omegaclaw.metta. This
; module adds one, in OmegaClaw's own idiom — AtomSpace atoms + derivation rules — so
; an agent can represent individual vs collective goals, surface conflicts, and reason
; about alignment.
;
; It is OPT-IN and SIDE-EFFECT-FREE on load (no queries run at import): it only defines
; the schema contract + parameterized rules. The agent (its LLM layer) materialises goal
; atoms from what it is reading, then calls these rules via the `metta` skill.
;
; Verified: loads on the standalone Hyperon interpreter AND in a live OmegaClaw runtime
; (PeTTa) — the conflict rule derives (conflict-between alice-train dao-fair-access) in the
; running agent's AtomSpace. Contributed from the BGI Sprint I project "Telos"
; (https://github.com/arielagor/telos), which also ships a 14-scenario goal-understanding
; benchmark you can run against OmegaClaw.
;
; Schema (atoms the agent asserts into &self while reading):
; (goal <id> <scope> <owner> <status>) scope: individual | collective
; status: active | proposed | achieved | abandoned
; (rel <type> <src> <dst>) type: supports | conflicts | subsumes | depends-on

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

subsumes is part of the public schema, but no current rule uses it and its direction is not documented. Is it intentionally reserved for future use?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was reserved, which is not a good state for a public schema entry. It is now used: telos-subgoals yields (subgoal <child> of <parent>) from (rel subsumes <parent> <child>), and the schema block documents that direction plus the general rule that every relation reads src -> dst. The tests assert the direction (the reversed pair yields nothing).

;
; Load with: !(import! &self (library OmegaClaw-Core lib_telos_goals))
; ============================================================================

; All conflict pairs the agent must surface (across ALL goals).
(= (telos-conflicts)
(match &self (rel conflicts $a $b) (conflict-between $a $b)))

; Every collective goal (what the commons wants).
(= (telos-collective-goals)
(match &self (goal $g collective $owner $status) (collective-goal $g $owner)))

; Goals owned by ANY given stakeholder (individual goal understanding).
(= (telos-goals-of $owner)
(match &self (goal $g individual $owner $status) (goal-of $owner $g)))

; A goal is ACHIEVED when its status atom says so.
(= (telos-achieved $g)
(match &self (goal $g $scope $owner achieved) True))

; BLOCKED: a goal that depends-on another goal that is not yet achieved.
(= (telos-blocked)
(match &self (rel depends-on $g $dep)
(match &self (goal $dep $s2 $o2 $st2)
(if (== $st2 achieved) (empty) (blocked $g on $dep)))))

; Cross-level ALIGNMENT: an individual goal that SUPPORTS a collective goal.
(= (telos-aligned)
(match &self (rel supports $i $c)
(match &self (goal $i individual $o1 $s1)
(match &self (goal $c collective $o2 $s2)
(aligns $i with $c)))))

; A full goal reading: run every lens. Call after asserting the goal/rel atoms.
(= (telos-reading)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

telos-reading is described as a “full goal reading,” but it seems to only cover the cross-goal/global view - achieved goals aren’t included because telos-achieved requires parameters.

Is that intentional? If so, maybe the naming/docs could make that clearer. Otherwise, would it make sense to add an all-achieved-goals view here?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, and it was not intentional. telos-reading now folds in every zero-arity lens, including three new ones: telos-achieved-goals (every achieved goal, any scope or owner), telos-abandoned-goals, and telos-subgoals. The two parameterised probes (telos-goals-of <owner>, telos-achieved <goal>) stay outside the reading because they need an argument, and both the source and the reference doc now say so explicitly. Covered in tests/tests_lib_telos_goals.metta (the "full reading includes every zero-arity lens" block).

(superpose ((telos-conflicts)
(telos-collective-goals)
(telos-blocked)
(telos-aligned))))