<PAGE>   1
                                                                   EXHIBIT 10.12

                          LOAN MODIFICATION AGREEMENT


     This Loan Modification Agreement is entered into as of June 22, 1998, by
and between COSINE COMMUNICATIONS, INC. ("Borrower") whose address is 1070 Sixth
Avenue, Suite 200, Belmont, CA 94002 and Silicon Valley Bank ("Bank") whose
address is 3003 Tasman Drive, Santa Clara, CA 95054.

1.   DESCRIPTION OF EXISTING INDEBTEDNESS. Among other indebtedness which may be
owing by Borrower to Bank, Borrower is indebted to Bank pursuant to, among other
documents, a Loan and Security Agreement, dated May 29, 1998, as may be amended
from time to time, (the "Loan Agreement"). The Loan Agreement provided for,
among other things, a Committed Equipment Line in the original principal amount
of One Million Two Hundred Fifty Thousand and 00/100 Dollars ($1,250,000.00) the
"Revolving Facility"). Defined terms used but not otherwise defined herein shall
have the same meanings as in the Loan Agreement.

Hereinafter, all indebtedness owing by Borrower to Bank shall be referred to as
the "indebtedness."

2.   DESCRIPTION OF COLLATERAL AND GUARANTIES. Repayment of the indebtedness is
secured by the Collateral as described in the Loan Agreement and that certain
Intellectual Property Security Agreement, dated May 29, 1998.

Hereinafter, the above-described security documents and guaranties, together
with all other documents securing repayment of the indebtedness shall be
referred to as the "Security Documents". Hereinafter, the Security Documents,
together with all other documents evidencing or securing the Indebtedness shall
be referred to as the "Existing Loan Documents".

3.   DESCRIPTION OF CHANGES IN TERMS.

     A.   Modification(s) to Loan Agreement.

          1.   The following Section is hereby incorporated to read as follows:

               2.1.2  Lease Advance Sublimit. Through the Equipment Availability
               Date, Bank will make advances (each, a "Lease Advance" and
               collectively, the "Lease Advances"), not exceeding $275,000 (the
               "Lease Advance Sublimit"). The Lease Advances may be used only to
               support lease arrangements. Borrower to provide to Bank invoices
               for the Lease Advances no later than the Equipment Availability
               Date, however such invoice do not need to accompany the advance
               request. All Lease Advances will be treated as Credit Extensions
               under the Committed Equipment Line. Lease Advances when repaid
               may not be reborrowed.

               2.1.3  Overadvances. If Borrower's Obligations under Sections
               2.1.1 and 2.1.2 exceed the Committed Equipment Line, Borrower
               must immediately pay in cash to Bank the excess.

          2.   The following definition is hereby incorporated into the Loan
          Agreement:

               "Lease Advance" is described in Section 2.1.2

4.   CONSISTENT CHANGES: The Existing Loan Documents are hereby amended wherever
necessary to reflect the changes described above.


                                       1
<PAGE>   2
5.   PAYMENT OF LOAN FEE. Borrower shall pay to Bank a fee in the amount of
Three Hundred Fifty and 00/100 Dollars ($350.00) (the "Loan Fee") plus all
out-of-pocket expenses.

6.   NO DEFENSES OF BORROWER. Borrower (and each guarantor and pledgor signing
below) agrees that, as of the date hereof, it has no defenses against the
obligations to pay any amounts under the indebtedness.

7.   CONTINUING VALIDITY. Borrower (and each guarantor and pledgor signing
below) understands and agrees that in modifying the existing indebtedness, Bank
is relying upon Borrower's representations, warranties, and agreements, as set
forth in the Existing Loan Documents. Except as expressly modified pursuant to
this Loan Modification Agreement, the terms of the Existing Loan Documents
remain unchanged and in full force and effect. Bank's agreement to modifications
to the existing indebtedness pursuant to this Loan Modification Agreement in no
way shall obligate Bank to make any future modifications to the indebtedness.
Nothing in this Loan Modification Agreement shall constitute a satisfaction of
the indebtedness. It is the intention of Bank and Borrower to retain as liable
parties all makers and endorsers of Existing Loan Documents, unless the party is
expressly released by Bank in writing. No maker, endorser, or guarantor will be
released by virtue of this Loan Modification Agreement. The terms of this
paragraph apply not only to this Loan Modification Agreement, but also to all
subsequent loan modification agreements.

8.   CONDITIONS. The effectiveness of this Loan Modification Agreement is
conditioned upon Borrower's payment of the Loan Fee.

     This Loan Modification Agreement is executed as of the date first written
above.

BORROWER:                                     BANK:

COSINE COMMUNICATIONS, INC.                   SILICON VALLEY BANK

By: /s/ CURTIS DUDNICK                        By: /s/  GREG OLSEN
   ---------------------------                   ---------------------------

Name: Curtis Dudnick                          Name: Greg Olsen
     -------------------------                     -------------------------

Title: CFO                                    Title:  Vice President
      ------------------------                      ------------------------


                                       2