{"id":45311626,"url":"https://github.com/minskylab/neocortex","last_synced_at":"2026-02-21T07:43:17.593Z","repository":{"id":45141640,"uuid":"175750396","full_name":"minskylab/neocortex","owner":"minskylab","description":"🧠Neocortex is a tool to connect your cognitive service (e.g. DialogFlow) 🤖 with your communication channels (like facebook) 📞to create amazing bots","archived":false,"fork":false,"pushed_at":"2023-12-15T17:36:25.000Z","size":218,"stargazers_count":27,"open_issues_count":3,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-08-14T05:21:13.985Z","etag":null,"topics":["chatbot","chatbot-framework","chatbots","fun","middleman","middleware"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/minskylab.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-03-15T04:50:40.000Z","updated_at":"2025-01-08T17:50:08.000Z","dependencies_parsed_at":"2024-06-19T09:59:45.995Z","dependency_job_id":"69317bcf-a825-419c-bac5-eb69ba681184","html_url":"https://github.com/minskylab/neocortex","commit_stats":null,"previous_names":["bregydoc/neocortex"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/minskylab/neocortex","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/minskylab%2Fneocortex","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/minskylab%2Fneocortex/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/minskylab%2Fneocortex/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/minskylab%2Fneocortex/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/minskylab","download_url":"https://codeload.github.com/minskylab/neocortex/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/minskylab%2Fneocortex/sbom","scorecard":{"id":648735,"data":{"date":"2025-08-11","repo":{"name":"github.com/minskylab/neocortex","commit":"36d8badb4b87c1ae3e32be024277a8732b423ec7"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":1.9,"checks":[{"name":"Code-Review","score":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":0,"reason":"Project has not signed or included provenance with any releases.","details":["Warn: release artifact v0.1-alpha not signed: https://api.github.com/repos/minskylab/neocortex/releases/16958287","Warn: release artifact v0.1-alpha does not have provenance: https://api.github.com/repos/minskylab/neocortex/releases/16958287"],"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":3,"reason":"7 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GO-2024-2955 / GHSA-869c-j7wc-8jqv","Warn: Project is vulnerable to: GO-2020-0001 / GHSA-6vm3-jj99-7229","Warn: Project is vulnerable to: GO-2021-0052 / GHSA-h395-qcrw-5vmq","Warn: Project is vulnerable to: GHSA-3vp4-m3rf-835h","Warn: Project is vulnerable to: GO-2023-1737 / GHSA-2c4m-59x9-fr2g","Warn: Project is vulnerable to: GO-2021-0112 / GHSA-f6mq-5m25-4r72","Warn: Project is vulnerable to: GO-2022-0493 / GHSA-p782-xgp4-8hr8"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-21T12:53:32.790Z","repository_id":45141640,"created_at":"2025-08-21T12:53:32.790Z","updated_at":"2025-08-21T12:53:32.790Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29676840,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-21T06:23:40.028Z","status":"ssl_error","status_checked_at":"2026-02-21T06:23:39.222Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["chatbot","chatbot-framework","chatbots","fun","middleman","middleware"],"created_at":"2026-02-21T07:43:16.674Z","updated_at":"2026-02-21T07:43:17.587Z","avatar_url":"https://github.com/minskylab.png","language":"Go","readme":"# Neocortex  🧠\n\nNeocortex is a tool to connect your cognitive service with your web services and communication channels.\n\nThe main goal of neocortex is offers a reliable and modern API to connect any kind of cognitive service* with any communication channel**. \n\n*Currently neocortex offers only two cognitive services: Watson and a simple Useless box as dummy service, you can collaborate to implement another cognitive service like DialogFlow or Amazon Lex, later I'm going to document how to implement this services but you can read the source code to understand how to.\n\n**Like cognitive services, I could only implement only two channels: Facebook Messenger and a simple Terminal chat (very simple to emulate a chat in your terminal), if you want you can collaborate implementing other channels like Slack, Whatsapp or Gmail, for example.\n\n*🚧 Neocortex is work in progress, it pretends to be a big collaborative project*\n\n###  TODO\n- [x] Think the paradigm and write the first types of neocortex.\n\n- [x] Describe a Cognitive Service interface (`type CognitiveService interface`)\n\n- [x] Describe a Communication channel interface (`type CommunicationChannel interface`)\n\n- [x] Implement the Watson cognitive service \n\n- [x] Implement the Facebook channel\n\n- [x] Implement persistence contexts and dialog sessions\n\n- [x] Implement analytics reports\n\n- [x] MongoDB repository driver\n\n- [ ] Write unit tests // working on\n\n- [ ] Make an iteration of the Communication channel's architecture \n\n- [ ] Think more in the Cognitive's orientation (paradigm, architecture, etc)\n\n- [ ] Improve the neocortex engine\n\n- [ ] Write the Gmail channel implementation\n\n- [ ] Write the Dialog flow service implementation\n\n- [ ] Improve facebook messenger API\n\n- [ ] Document more\n\n- [ ] Document more more!\n\n\n## Install\n\nInstall with:\n\n```go get -u github.com/minskylab/neocortex```\n\nCurrently, neocortex has 2 implementations of Cognitive Services (Useless-box created by me and Watson Assistant based on the [watson official API v2](https://github.com/watson-developer-cloud/go-sdk)) and 2 implementations of Communication Channels (Terminal based UI written by me and Facebook Messenger forked from [Facebook-messenger API](https://github.com/mileusna/facebook-messenger) by [mileusna](https://github.com/mileusna)).\n\n### Basic Example\n\n```go\npackage main\n\nimport (\n\tneo \"github.com/minskylab/neocortex\"\n\t\"github.com/minskylab/neocortex/channels/terminal\"\n\t\"github.com/minskylab/neocortex/cognitive/uselessbox\"\n\t\"github.com/minskylab/neocortex/repositories/boltdb\"\n)\n\n// Example of use useless box with terminal channel\nfunc main() {\n\tbox := uselessbox.NewCognitive()\n\tterm := terminal.NewChannel(nil)\n\n\trepo, err  := boltdb.New(\"neocortex.db\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\t\n\tengine, err := neo.New(repo, box, term)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tengine.ResolveAny(term, func(in *neo.Input, out *neo.Output, response neo.OutputResponse) error {\n\t\tout.AddTextResponse(\"-----Watermark-----\")\n\t\treturn response(out)\n\t})\n\n\tif err = engine.Run(); err != nil {\n\t\tpanic(err)\n\t}\n}\n\n```\nYou can see more examples [here](https://github.com/minskylab/neocortex/tree/master/examples).\n\n## Paradigm\n\nNeocortex is like a middleware with a mux, with it you can catch your message input, pass to your cognitive service, inflate or modify them and respond.\n\n### Concepts\n\n1. **Cognitive Service**\n\n   Represents any service that decodes and find intents and entities in a human message. In neocortex, this is described by a simple interface.\n\n   ```go\n   type CognitiveService interface {\n      CreateNewContext(c *context.Context, info neocortex.PersonInfo) *neocortex.Context\n      GetProtoResponse(in *neocortex.Input) (*neocortex.Output, error)\n   }\n   ```\n\n   you can see the implementation of a [Useless box](https://github.com/minskylab/neocortex/tree/master/cognitive/uselessbox) or [Watson Assistant](https://github.com/minskylab/neocortex/tree/master/cognitive/watson).\n\n2. **Communication Channel**\n\n   A Communication Channel is any human interface where a person can to send a message and receive a response. Currently, I think we need to work more in the paradigm behind Communication channels. In neocortex a communication channel is described by the following interface:\n\n   ```go\n   type CommunicationChannel interface {\n      RegisterMessageEndpoint(handler neocortex.MiddleHandler) error\n      ToHear() error\n      GetContextFabric() neocortex.ContextFabric\n      SetContextFabric(fabric neocortex.ContextFabric)\n      OnNewContextCreated(callback func(c *neocortex.Context))\n   }\n   ```\n\n   Please, read how to are implemented the [Terminal channel](https://github.com/minskylab/neocortex/tree/master/channels/terminal) or [Facebook Messenger Channel](https://github.com/minskylab/neocortex/tree/master/channels/facebook).\n\n3. **Context**\n\n   Neocortex's Context represents a \"session\" or \"dialog\" with a human, it contains essential information about the person with we're a conversation.\n\n   ```go\n   // Context represent the context of one conversation\n   type Context struct {\n      Context   *context.Context // go native context implementation\n      SessionID string           \n      Person    neocortex.PersonInfo             \n      Variables map[string]interface{} //conversation context variables\n   }\n   ```\n\n4. **Input**\n\n   An input is a message input, that's all. Input has a specified type and in the neocortex is a struct:\n\n   ```go\n   type Input struct {\n      Context  *neocortex.Context\n      Data     neocortex.InputData\n      Entities []neocortex.Entity\n      Intents  []neocortex.Intent\n   }\n   ```\n\n   Intents and Entities define the message.\n\n5. **Output**\n\n   An output represents a response in a conversation, with this you can define the response to your communication channel (e.g. facebook messenger) and if your channel allows you can respond different types of response (e.g. Image, Audio,  Attachment, etc).\n\n   ```go\n   type Output struct {\n      Context      *neocortex.Context\n      Entities     []neocortex.Entity\n      Intents      []neocortex.Intent\n      VisitedNodes []*neocortex.DialogNode\n      Logs         []*neocortex.LogMessage\n      Responses    []neocortex.Response // A list of responses\n   }\n   \n   type Response struct {\n       IsTyping bool\n       Type     neocortex.ResponseType\n       Value    interface{}\n   }\n   ```\n\n6. **Engine**\n\n   This is the core of neocortex it can to connect and manage your Cognitive service and your Communication channels. the engine has different methods for intercept a message and modifies it.\n\n   ```go\n   // Create a New neocortex Engine\n   func New(cognitive CognitiveService, channels ...CommunicationChannel) (*Engine, error) {}\n   \n   // Register a new resolver, you need a matcher\n   func (engine *Engine) Resolve(channel CommunicationChannel, matcher Matcher, handler HandleResolver) {}\n   \n   // Maatcher\n   type Matcher struct {\n       Entity Match\n       Intent Match\n       AND    *Matcher\n       OR     *Matcher\n   }\n   // Match\n   type Match struct {\n       Is         string\n       Confidence float64\n   }\n   ```\n\n   \n\n7. **Resolver**\n    \n    This is the core of the neocortex paradigm, with this you can intercept a message and modify or only bypass it. You need to pass a Matcher who is used to match with your message inputs, you can see below how looks like a Matcher struct. Above you can see two examples of a matcher:\n    \n    ```go\n    // match if the input has a Regard or Goodbye intents \n    match := neo.Matcher{Intent: neo.Match{Is: \"REGARD\"}, OR: \u0026neo.Matcher{Intent: neo.Match{Is: \"GOODBYE\"}}}\n    \n    // match if the input is an insult intent and has a bad_word entity\n    match := neo.Matcher{\n     Intent: neo.Match{Is:\"INSULT\", Confidence: 0.8}, \n     AND: \u0026neo.Matcher{\n       Entity: neo.Match{\n         Is: \"bad_word\",\n       },\n     },\n    }\n    ```\n    \n    Register a new resolver is simple, see the following example above\n    \n    ```go\n    match := neo.Matcher{Intent: neo.Match{Is:\"HELLO\", Confidence: 0.8}}\n    engine.Resolve(fb, match, func(in *neo.Input, out *neo.Output, response neo.OutputResponse) error {\n      out.AddTextResponse(\"Powered by neocortex\")\n      return response(out)\n    })\n    ```\n    \n    You can make another type of Resolves.\n    \n    ```go\n    func (engine *Engine) ResolveAny(channel CommunicationChannel, handler HandleResolver) {}\n    func (engine *Engine) Resolve(channel CommunicationChannel, matcher Matcher, handler HandleResolver) {}\n    func (engine *Engine) ResolveMany(channels []CommunicationChannel, matcher Matcher, handler HandleResolver) {}\n    func (engine *Engine) ResolveManyAny(channels []CommunicationChannel, handler HandleResolver) {}\n    ```\n\n\n\n🚧 Work in progress documentation, if you want to help, only send me an email.\n\n\n![love open source](https://github.com/bregydoc/torioux-hands/raw/master/I_love_opensource.png)\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fminskylab%2Fneocortex","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fminskylab%2Fneocortex","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fminskylab%2Fneocortex/lists"}