<PAGE>
                                                                    EXHIBIT 10.5
                             INFERENCE CORPORATION
                          EMPLOYEE STOCK PURCHASE PLAN
                         (as amended January 19, 1999)
1.  Definitions.

     (a) "Base Pay" means a Qualified Employee's gross pay for a 40-hour week,
excluding overtime payments, incentive compensation, bonuses, sales commission,
relocation or attributed types of compensation, and other special payments, fees
or allowances.

     (b) "Board" means the Board of Directors of the Company.

     (c) "Code" means the Internal Revenue Code of 1986, as amended and as it
may hereafter be amended from time to time.

     (d) "Committee" has the meaning set forth in Section 13 hereof.

     (e) "Common Stock" means the Class A Common Stock of the Company, $0.01 par
value per share.

     (f) "Company" means Inference Corporation, a Delaware corporation, and its
successors.

     (g) "Effective Date" means the effective date of this Plan as set forth in
Section 14 of this Plan.

     (h) "Exchange Act" means the Securities Exchange Act of 1934, as amended,
and as it may hereafter be amended from time to time.

     (i) "Exercise Date" has the meaning set forth in Section 4(a) hereof.

     (j) "Fair Market Value" means the closing price of the Common Stock on the
NASDAQ National Market System as reported and published in the Western Edition
of The Wall Street Journal, or if there is no trading of the Common Stock on the
date in question, then the average of the high and low price of the Common
Stock, as so reported and published, on the next preceding date on which there
was trading in the Common Stock; provided, however, that the Committee, in
determining such Fair Market Value, may utilize such other exchange, market or
other factors affecting value of the Common Stock as it may deem appropriate.

     (k) "Grant Date" has the meaning set forth in Section 4(a) hereof.

     (l) "Offering Period" has the meaning set forth in Section 4(a) hereof.

     (m) "Option Price" has the meaning set forth in Section 5(b) hereof.
<PAGE>

     (n) "Participant" means a Qualified Employee who elects to participate in
this Plan during an Offering Period.

     (o) "Personal Representative" means the person or persons who, upon the
death or Total Disability of a Participant, shall have acquired, on behalf of
the Participant by legal proceeding or under the laws of descent and
distribution or otherwise, the right to exercise the Participant's rights under,
or to receive the benefits specified in, this Plan.

     (p) "Plan" means this Inference Corporation Amended and Restated Employee
Stock Purchase Plan, as it may be amended from time to time.

     (q) "Plan Year" means December 1 through November 30.

     (r) "Qualified Employee" means any employee of the Company or any
Subsidiary who has completed one (1) month of continuous service with the
Company or a Subsidiary as of the Grant Date and who is customarily employed for
more than 20 hours per week and more than five months in a calendar year.
Notwithstanding the foregoing, the term "Qualified Employee" does not include
any employee who, immediately after the option is granted, owns (within the
meaning of Sections 423(b)(3) and 424(d) of the Code) stock representing 5% or
more of the total combined voting power or value of all classes of stock of the
Company or a Subsidiary.

     (s) "Retirement" means the voluntary termination of employment of a
Participant who either (i) is at least 55 years of age and has completed at
least ten (10) years of service with the Company or a Subsidiary, or (ii) is at
least 65 years of age.

     (t) "Subsidiary" means any corporation or other entity, at least a majority
of whose outstanding voting stock or voting power is beneficially owned directly
or indirectly by the Company.

     (u) "Total Disability" means the total and permanent physical or mental
disability of a Participant, evidenced by an inability to engage in any
substantial gainful activity, as determined by the Committee.

     All references herein to the masculine shall also be references to the
feminine or neuter as appropriate.

     2. Purpose, Summary. The purpose of this Plan is to assist Qualified
Employees in acquiring a stock ownership interest in the Company pursuant to a
plan which is intended to qualify as an "employee stock purchase plan" under
Section 423 of the Code. Under this Plan, Participants are deemed to have been
granted options to purchase shares of Common Stock. Participants may designate a
certain amount of their Base Pay to be set aside during the Offering Period for
the purpose of purchasing Common Stock. At the end of the Offering Period, the
Participants are deemed to have exercised their options using the funds set
aside for them and the Company issues share certificates to them. The Plan is
intended, among other things, to provide an additional incentive to
Participants, through the ownership of Common Stock, to achieve business goals
that would increase stock values and to remain in the employ of the Company or a
Subsidiary.

                                      -2-
<PAGE>

     3. Stock Subject to this Plan. Subject to the provisions of Section 10
hereof (relating to adjustments upon changes in capitalization), the total
number of shares available under this Plan is 500,000 shares of Common Stock.
Such shares may be authorized but unissued shares.

     4. Grant of Options.

     (a) In General. The Company will offer on December 1 and June 1 of each
year options to purchase shares of Common Stock under this Plan to all
Participants. Subject to Section 5(b), the term of each option ("Offering
Period") shall be for a 24 month period beginning every six months (December 1
and June 1) and continuing until terminated, and each Offering Period has 4
"Exercise Dates", occurring one day prior to the date 6 months, 12 months, 18
months and 24 months from the commencement of the Offering Period. The first day
of each 24 month Offering Period is called the "Grant Date". Shares are
automatically purchased on behalf of Participants every 6 months on the Exercise
Dates, unless a Participant withdraws from the Offering Period prior to such
date. The number of shares subject to each option and deemed to be purchased by
each Participant shall be the quotient, rounded down to the nearest whole
number, of (i) the aggregate payroll deductions authorized by each Participant
in accordance with Section 4(b) below made during the Offering Period, divided
by (ii) the Option Price.

     (b) Election to Participate; Payroll Deduction Authorization. Except as
provided in Section 4(d) below, a Qualified Employee may participate in this
Plan only by means of payroll deductions. Each Qualified Employee who elects to
participate in this Plan shall deliver to the Company, no later than the 15th
day of the month next preceding a Grant Date, or the next business day following
such date if such day is not a business day, a written payroll deduction
authorization in a form approved by the Company pursuant to which he gives
notice of his election to participate in this Plan as of the next following
Grant Date, and whereby he designates a stated amount to be deducted from his
Base Pay on each payday during the next Offering Period and credited to his
account under this Plan ("Account"). The stated amount to be deducted from a
Participant's Base Pay may not be less than $10.00 per pay period. The aggregate
stated amount for any Offering Period may not exceed either of the following:
(i) ten percent (10%) of the Participant's Base Pay during the Offering Period;
or (ii) an amount which will result in noncompliance with the $25,000 limitation
stated in Section 4(c) below. A Participant may decrease the amount of payroll
deductions at any time during the Offering Period by completing and submitting a
written payroll deduction authorization. A Participant may increase the amount
of payroll deductions only on the next Plan Grant Date, at which time the
Participant will begin a new 24 month Offering Period. In the event the number
of shares of Common Stock subject to options during an Offering Period exceeds
the number of shares then available under this Plan, the available shares shall
be allocated among the Participants in proportion to the balance of their
Accounts at the end of the Offering Period, and any amounts credited to their
Accounts after giving effect to shares purchased that year shall be refunded to
the Participants.

     (c) $25,000 Limitation. No Participant shall be deemed to have been granted
options under this Plan which would permit his rights to purchase Common Stock
under this Plan or any other employee stock purchase plan of the Company or any
Subsidiary to accrue at a rate which exceeds $25,000 of Fair Market Value of
Common Stock for any calendar year. For purposes of this subsection (c), the
right to purchase Common Stock under an option accrues when the option (or any


                                      -3-
<PAGE>

portion thereof) becomes exercisable, and the right to purchase Common Stock
which has accrued during one Offering Period may not be carried over to any
subsequent Offering Period.

     (d) Leaves of Absence. During leaves of absence approved by the Company and
meeting the requirements of Regulation Section 1.421-7(h)(2) under the Code, a
Participant may continue participation in this Plan by making cash payments to
the Company on the Company's normal paydays equal to the reduction in his
payroll deduction attributable to his leave.

     5. Exercise of Options.

     (a) In General. On each Exercise Date, each Participant automatically and
without any act on his part will be deemed to have exercised his option to the
extent that the balance then credited to his Account is sufficient to purchase
whole shares of Common Stock at the Option Price. After giving effect to the
purchase of such whole shares, any balance of Participant's contributions will
remain in his Account. Notwithstanding the foregoing, the maximum number of
shares which can be subject to exercise by any Participant in any Offering
Period shall not exceed two hundred percent (200%) of the number of shares
determined by dividing ten percent (10%) of such Participant's Base Pay to be
accumulated over such Offering Period (determined as of the first day of such
Offering Period) by eighty-five percent (85%) of the fair market value of a
share of the Company's Common Stock on the first day of such Offering Period.


     (b) "Option Price" Defined. The Option Price per share on the Exercise
Dates is the lower of (i) 85% of the Fair Market Value of a share of Common
Stock on the Grant Date or (ii) 85% of the Fair Market Value of a share of
Common Stock on the Exercise Date (or the date of the Participant's Retirement,
death or Total Disability if any such event occurs). The Fair Market Value of
the Common Stock on a given date shall be the closing sale price on that date
reported on the NASDAQ National Market System. If the Fair Market Value of the
Company's Common Stock is lower on an Exercise Date than it was on the Grant
Date, all participants shall be deemed to have withdrawn from the Offering
Period immediately after the exercise of their option on such Exercise Date and
to have enrolled as participants in a new Offering Period beginning on the day
after the Exercise Date on which the lower Common Stock price occurred, which
shall be the Grant Date of a new 24 month Offering Period. Employees may elect
to remain in the previous Offering Period by filing a written statement with the
Company prior to the automatic change to the new Offering Period.

     (c) Delivery of Share Certificates. Subject to Section 5(d) below, the
Company will deliver to each Participant a certificate issued in the
Participant's name for the number of shares with respect to which his option was
exercised. The Company will deliver the certificate as soon as practicable
following the Exercise Date.

     (d) Government Regulations. This Plan, the granting of options under this
Plan and the issuance of Common Stock pursuant hereto are subject to all
applicable federal and state laws, rules and regulations and to such approvals
by any regulatory or governmental agency which may, in the opinion of counsel
for the Company, be necessary or advisable in connection therewith. Without
limiting the generality of the foregoing, no options may be granted under this
Plan, and no shares may be issued by the Company, unless and until, in each such
case, all legal requirements


                                      -4-
<PAGE>

applicable to the grant or issuance have, in the opinion of counsel to the
Company, been complied with. In connection with the issuance of Common Stock
hereunder, the Participant shall, if requested by the Company, give assurances
satisfactory to counsel to the Company in respect of such matters as the Company
may deem desirable to assure compliance with all applicable legal requirements.

     6. Withdrawal from this Plan.

     (a) In General. Any Participant may completely withdraw from this Plan at
any time. A Participant who desires to withdraw from this Plan must deliver to
the Company a notice of withdrawal in a form approved by the Company. Promptly
following the time when the notice of withdrawal is delivered, the Company will
refund to the Participant the amount of the balance of his Account, without
interest thereon, and the Participant's payroll deduction authorization,
interest in this Plan and option under this Plan shall thereupon terminate.

     (b) Eligibility Following Withdrawal. A Participant who has withdrawn from
this Plan shall again be eligible to participate in this Plan in the next
Offering Period.

     7. Termination of Employment.

     (a) Termination of Employment Other than by Retirement, Death or Total
Disability. If the employment of a Participant by the Company or a Subsidiary
terminates during an Offering Period other than by reason of Retirement, death
or Total Disability, his participation in this Plan automatically and without
any act on his part shall terminate as of the date of the termination of the
Participant's employment. The Company promptly will refund to the Participant
the amount of the balance of his Account, without interest thereon, and
thereupon his interest in and option under this Plan shall terminate. Nothing in
this Plan shall prevent the Company or any Subsidiary from terminating any
Participant's employment.

     (b) Termination by Retirement. If a Participant's employment terminates
during an Offering Period because of Retirement of the Participant, the
Participant may, at his election by written notice to the Company, either (i)
exercise his option as of his Retirement date, in which event the Company shall
apply the balance of his Account to the purchase, at the Option Price, of whole
shares of Common Stock and refund the excess, if any, or (ii) request payment of
the balance of his Account, in which event the Company promptly shall make such
payment, without interest thereon, and thereupon his interest in and option
under this Plan shall terminate. If the Participant elects to exercise his
option, the date of his Retirement shall be deemed to be the Exercise Date for
the purpose of computing the Option Price.

     (c) Termination by Death or Total Disability. If a Participant dies or
suffers a Total Disability during an Offering Period, the Participant or his
Personal Representative, as the case may be, by written notice to the Company,
may either (i) exercise the Participant's option as of the date of death or
Total Disability, in which event the Company shall apply the balance of his
Account to the purchase, at the Option Price, of whole shares of Common Stock
and refund the excess, if any, or (ii) request payment of the balance of the
Participant's Account, in which event the Company promptly shall make such
payment to the Participant or his Personal Representative, and thereupon



                                      -5-
<PAGE>

the Participant's interest in and option under this Plan shall terminate. If the
option is exercised, the date of death or Total Disability shall be deemed to be
the Exercise Date for the purpose of computing the Option Price. If the Company
does not receive such notice within 90 days of the date of Participant's death
or Total Disability, the Participant or his Personal Representative shall be
conclusively presumed to have elected alternative (ii) above and requested the
payment of the balance of the Participant's Account.

     8. Restriction Upon Assignment. An option granted under this Plan shall not
be transferable otherwise than by will or the laws of descent and distribution
pursuant to Section 7(c) hereof, and is exercisable during the Participant's
lifetime only by the Participant (or his Personal Representative in the event of
the Participant's Total Disability). The Company will not recognize any
assignment or purported assignment by a Participant of his option or of any
rights under his option or under this Plan.

     9. No Rights as Shareholder. With respect to shares of Common Stock subject
to an option, a Participant shall not be deemed to be a shareholder and shall
not have any of the rights or privileges of a shareholder until a certificate
for shares of Common Stock has been issued to the Participant following the
exercise of his option.

     10. Adjustments Upon Changes in Capitalization, Dissolution, Liquidation,
Merger or Asset Sale.

     (a) Changes in Capitalization. Subject to any required action by the
stockholders of the Company, the number of shares reserved under this Plan, the
price per share and the number of shares of Common Stock covered by each option
under the Plan which has not yet been exercised shall be proportionately
adjusted for any increase or decrease in the number of issued shares of Common
Stock resulting from a stock split, reverse stock split, stock dividend,
combination or reclassification of the Common Stock, or any other increase or
decrease in the number of shares of Common Stock effected without receipt of
consideration by the Company; provided, however, that conversion of any
convertible securities of the Company shall not be deemed to have been "effected
without receipt of consideration". Such adjustment shall be made by the Board,
whose determination in that respect shall be final, binding and conclusive.
Except as expressly provided herein, no issuance by the Company of shares of
stock of any class, or securities convertible into shares of stock of any class,
shall affect, and no adjustment by reason thereof shall be made with respect to,
the number or price of shares of Common Stock subject to an option.

     (b) Dissolution or Liquidation. In the event of the proposed dissolution or
liquidation of the Company, the Offering Period then in progress shall be
shortened by setting a new Exercise Date (the "New Exercise Date"), and shall
terminate immediately prior to the consummation of such proposed dissolution or
liquidation, unless provided otherwise by the Board. The New Exercise Date shall
be before the date of the Company's proposed dissolution or liquidation. The
Board shall notify each participant in writing, at least ten (10) business days
prior to the New Exercise Date, that the Exercise Date for the participant's
option has been changed to the New Exercise Date and that the participant's
option shall be exercised automatically on the New Exercise Date, unless prior
to such date the participant has withdrawn from the Offering Period as provided
in Section 6 hereof.

                                      -6-

<PAGE>

     (c) Merger or Asset Sale. In the event of a proposed sale of all or
substantially all of the assets of the Company, or the merger of the Company
with or into another corporation, each outstanding option shall be assumed or an
equivalent option substituted by the successor corporation or a parent or
subsidiary of the successor corporation. In the event that the successor
corporation refuses to assume or substitute for the option, the Offering Period
then in progress shall be shortened by setting a new Exercise Date (the "New
Exercise Date"). The New Exercise Date shall be before the date of the Company's
proposed sale or merger. The Board shall notify each participant in writing, at
least ten (10) business days prior to the New Exercise Date, that the Exercise
Date for the participant's option has been changed to the New Exercise Date and
that the participant's option shall be exercised automatically on the New
Exercise Date, unless prior to such date the participant has withdrawn from the
Offering Period as provided in Section 6 hereof.

     11. Use of Funds; No Interest Paid. All amounts withheld from Participants'
paychecks hereunder and credited to their Accounts will be included in the
general funds of the Company free of any trust or other restriction and may be
used by the Company for any corporate purpose. Under no circumstances shall
interest on such amounts be paid to any Participant or credited to his Account.

     12. Amendment of This Plan. The Board may at any time and for any reason
terminate or amend the Plan. Except as provided in Section 9 hereof, no such
termination can affect options previously granted, provided that an Offering
Period may be terminated by the Board on any Exercise Date if the Board
determines that the termination of the Offering Period or the Plan is in the
best interests of the Company and its shareholders. Except as provided in
Section 9 and Section 11 hereof, no amendment may make any change in any option
theretofore granted which adversely affects the rights of any participant. To
the extent necessary to comply with Section 423 of the Code (or any other
applicable law, regulation or stock exchange rule), the Company shall obtain
shareholder approval in such a manner and to such a degree as required.

     Without shareholder consent and without regard to whether any participant
rights may be considered to have been "adversely affected," the Board (or its
committee) shall be entitled to change the Offering Periods, limit the frequency
and/or number of changes in the amount withheld during an Offering Period,
establish the exchange ratio applicable to amounts withheld in a currency other
than U.S. dollars, permit payroll withholding in excess of the amount designated
by a participant in order to adjust for delays or mistakes in the Company's
processing of properly completed withholding elections, establish reasonable
waiting and adjustment periods and/or accounting and crediting procedures to
ensure that amounts applied toward the purchase of Common Stock for each
participant properly correspond with amounts withheld from the participant's
Base Pay, and establish such other limitations or procedures as the Board (or
its committee) determines in its sole discretion advisable which are consistent
with the Plan.

     In the event the Board determines that the ongoing operation of the Plan
may result in unfavorable financial accounting consequences, the Board may, in
its discretion and, to the extent necessary or desirable, modify or amend the
Plan to reduce or eliminate such accounting consequence including, but not
limited to:

                                      -7-


<PAGE>

          (a) altering the Option Price for any Offering Period including an
     Offering Period underway at the time of the change in Option Price;

          (b) shortening any Offering Period so that Offering Period ends on a
     new Exercise Date, including an Offering Period underway at the time of the
     Board action; and

          (c) allocating shares.

     Such modifications or amendments shall not require shareholder approval or
the consent of any Plan participants.

     13. Administration by Committee; Rules and Regulations. The Plan shall be
administered by the Board or a committee of members of the Board appointed by
the Board. The Board or its committee shall have full and exclusive
discretionary authority to construe, interpret and apply the terms of the Plan,
to determine eligibility and to adjudicate all disputed claims filed under the
Plan. Every finding, decision and determination made by the Board or its
committee shall, to the full extent permitted by law, be final and binding upon
all parties.

     14. Effective Date. The Plan as amended and restated hereby, shall become
effective as of June 1, 1997.

     15. Term. No option may be granted during any period of suspension nor
after termination of this Plan, and in no event may any option be granted under
this Plan after the date on which all of the Common Stock available under this
Plan has been purchased.

     16. Effect Upon Other Plans. The adoption of this Plan shall not affect any
other compensation or incentive plans in effect for the Company or any
Subsidiary. Nothing in this Plan shall be construed to limit the right of the
Company or any Subsidiary (a) to establish any other forms of incentives or
compensation for employees of the Company or any Subsidiary or (b) to grant or
assume options otherwise than under this Plan in connection with any proper
corporate purpose.

     17. Headings. Headings are provided herein for convenience only and shall
not serve as a basis for interpretation or construction of this Plan.

     18. Governing Law; Severability. This Plan shall be governed by, and
construed and enforced in accordance with, the laws of the State of California.
If any provisions shall be held by a court of competent jurisdiction to be
invalid and unenforceable, the remaining provisions of this Plan shall continue
to be in full force and effect.

     19. No Employment Rights. The Plan does not, directly or indirectly, create
any right for the benefit of any employee or class of employees to purchase any
shares under the Plan, or create in any employee or class of employees any right
with respect to continuation of employment by the Company, and it shall not be
deemed to interfere in any way with the Company's right to terminate, or
otherwise modify, an Employee's employment at any time.

     20. Effect of Plan. The provisions of the Plan shall, in accordance with
its terms, be binding upon, and inure to the benefit of, all successors of each
Employee participating in the Plan,

                                      -8-

<PAGE>

including, without limitation, such Employee's estate and the executors,
administrators or trustees thereof, heirs and legatees, and any receiver,
trustee in bankruptcy or representative of creditors of such Employee.

     This Plan as amended and restated hereby is adopted effective as of the
Effective Date.

                                 INFERENCE CORPORATION

                                 By:   /s/ Charles W. Jepson
                                       --------------------------------------
                                       Charles W. Jepson, President and
                                       Chief Executive Officer





                                      -9-