/ NEUROSYM.scm
NEUROSYM.scm
1 ; SPDX-License-Identifier: AGPL-3.0-or-later 2 ; NEUROSYM.scm - Neurosymbolic reasoning patterns 3 4 (neurosym 5 (version "1.0.0") 6 (schema-version "1.0") 7 8 (domain-model 9 (entities 10 (bitbucket-workspace 11 (attributes username app-password repos) 12 (relations (owns repo))) 13 14 (repository 15 (attributes name slug is-private description) 16 (relations (belongs-to workspace) (has-many branches))) 17 18 (credentials 19 (attributes username app-password workspace) 20 (storage "~/.config/bitfuckit/config") 21 (security user-only-permissions))) 22 23 (operations 24 (authenticate 25 (precondition "Has app password") 26 (postcondition "Credentials stored locally") 27 (idempotent #t)) 28 29 (create-repo 30 (precondition "Authenticated and repo does not exist") 31 (postcondition "Repo exists on Bitbucket") 32 (idempotent #f)) 33 34 (delete-repo 35 (precondition "Authenticated and repo exists") 36 (postcondition "Repo no longer exists") 37 (requires-confirmation #t) 38 (idempotent #t)) 39 40 (mirror 41 (precondition "In git repo, authenticated, source has commits") 42 (postcondition "Bitbucket repo contains all source branches") 43 (idempotent #t)))) 44 45 (reasoning-patterns 46 (error-diagnosis 47 (pattern "API returns 401") 48 (inference "Credentials invalid or expired") 49 (action "Re-run auth login")) 50 51 (pattern "API returns 404 on repo operation") 52 (inference "Repo does not exist or wrong workspace") 53 (action "Check workspace and repo name")) 54 55 (pattern "Push fails with permission denied") 56 (inference "SSH key not in Bitbucket or app password lacks repo:write") 57 (action "Add SSH key or update app password permissions")) 58 59 (invariants 60 (credentials-never-logged 61 "App password must never appear in logs or error messages") 62 63 (confirmation-before-delete 64 "Delete operations require explicit user confirmation") 65 66 (atomic-config-writes 67 "Config file writes are atomic to prevent corruption")))