Skip to content

Instantly share code, notes, and snippets.

@patham9
Last active February 3, 2026 02:48
Show Gist options
  • Select an option

  • Save patham9/9e960643d3f39c8e669f7dde02afa193 to your computer and use it in GitHub Desktop.

Select an option

Save patham9/9e960643d3f39c8e669f7dde02afa193 to your computer and use it in GitHub Desktop.
Persistent atomspace of (capital country) incrementally grown by local VLM (runnable with PeTTa v1.0.x)
!(import! &self (library lib_spaces))
!(import! &self (library lib_import))
!(git-import! "https://github.com/patham9/petta_lib_localvlm.git")
!(import_prolog_functions_from_file (library lib_localvlm.pl) (vlm_query vlm_embed))
!(git-import! "https://github.com/patham9/petta_lib_snapshot.git")
!(import! &self (library lib_snapshot))
(= (forever)
(progn (case (catch (sread (vlm_query "http://192.168.1.129:2276"
"give me 5 capitals, format is strict S-Expression, output nothing else: ((capital1 country1) ... (cityn countryn))"
300))) ;max output tokens
(((Error $A $B) alsofine)
($z (collapse (let $capital_country (superpose $z)
(if (not (find &cities $capital_country))
(add-atom &cities $capital_country)))))))
(println! (collapse (get-atoms &cities)))
(Snapshot)
(forever)))
!(CallWithSnapshotInterval (forever) 1)
@patham9
Copy link
Author

patham9 commented Feb 3, 2026

Executing sh run.sh vlmspace.metta starts the extension of &cities. swipl -x continue.p resumes it after killing the swipl process.

@patham9
Copy link
Author

patham9 commented Feb 3, 2026

Example:

sh run.sh vlmspace.metta
((Berlin Germany) (Paris France) (Tokyo Japan) (Canberra Australia) (Rome Italy))
((Berlin Germany) (Paris France) (Tokyo Japan) (Canberra Australia) (Rome Italy) (Madrid Spain) (Athens Greece))
((Berlin Germany) (Paris France) (Tokyo Japan) (Canberra Australia) (Rome Italy) (Madrid Spain) (Athens Greece) (London UnitedKingdom))
^Z
[50]+  Stopped                 sh run.sh vlmspace.metta
nartech@nartech-QEMU-Virtual-Machine:~/PeTTa$ swipl -x continue.p
((Berlin Germany) (Paris France) (Tokyo Japan) (Canberra Australia) (Rome Italy) (Madrid Spain) (Athens Greece) (London UnitedKingdom) (Lisbon Portugal))
((Berlin Germany) (Paris France) (Tokyo Japan) (Canberra Australia) (Rome Italy) (Madrid Spain) (Athens Greece) (London UnitedKingdom) (Lisbon Portugal) (Wellington NewZealand))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment